1
我需要回調,如果應用程序從後臺恢復,但onResume()
始終被稱爲活動啓動。onResume()僅當恢復活動
我打開一個活動:
Intent i = new Intent(this, Spedizione.class);
i.putExtra("codice", result.getText());
startActivity(i);
的onResume代碼:
@Override
protected void onResume() {
super.onResume();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure?").setPositiveButton("Yes", dialogClickListener)
.setNegativeButton("No", dialogClickListener).show();
}
當開放活動onResume()
隨時撥打AlertDialog,不僅當應用程序是從背景簡歷,爲什麼呢?
我只需要回調,只有當應用程序從後臺重新打開。
該文檔解釋它:https://developer.android.com/guide/components/activities/activity-lifecycle.html#alc –