Iam有點驚訝與此。我有一個onResume()在我activity.Its調用,並在我的模擬器,但在一個物理設備三星星系說明爲特定與安裝的軟糖,它不叫。相反onCreate()被稱爲所有的時間。爲什麼會發生這種情況?onResume()不在物理設備中調用,而是在調用onCreate()
public void onResume(){
super.onResume();
if(firsttime){
try {
Toast.makeText(getApplicationContext(), "Resuming Activity",Toast.LENGTH_LONG).show();
addReminder();
} catch(Exception exception) {
exception.printStackTrace();
}
} else {
firsttime=true;
}
}
這是我code.firsttime是一個靜態布爾variable.It是用來防止的onResume()時,應用程序啓動首次
後一些代碼。你怎麼知道它沒有被調用? – vilpe89
完全postResResume方法 – Ruban
'firsttime'不是'靜態int',而是'靜態布爾值',我想。 –