【问题标题】:How to make rest of methods start after new intent activity is finished如何在新的意图活动完成后启动其余方法
【发布时间】:2021-10-22 16:20:35
【问题描述】:

我从下面的一个函数中调用新活动。

我想让 loadRoundFromExercise() ~ updateRound() 方法在从 openRegisterPopupActivity() 调用的新活动完成后启动

我想把 sleep 方法。但我无法估计用户要输入多长时间。

那么.. 我该如何解决这个问题?请帮帮我。

谢谢。

adapter.setRoutineListener(new HealthRoutineViewHolder.Listener() {
@Override
public void onAddItem(ExerciseLog exerciseLog) {
    setupLogReference(exerciseLog);

    openRegisterPopupActivity(); // I call new activity here by intent.

    loadRoundFromExercise();

    convertToRoundLog();

    updateRound();
}

【问题讨论】:

    标签: android function android-intent stack-trace


    【解决方案1】:

    您可以使用startActivityForResult()onActivityResult() 回调。这些基本上是让 Activity A 启动 Activity B,然后将结果返回给 Activity A。

    Use onactivityresult android

    【讨论】:

    • 结果相同。 onActivityResult 在函数完成后启动
    • onActivityResult()内部调用其他函数。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-15
    • 1970-01-01
    • 1970-01-01
    • 2021-10-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多