1

物理按鍵工作,我想創造出具有兩個活動的一個簡單的應用程序......我想跳,從一個又一個的活動,而不執行的OnDestroy();我想在那裏發生OnPause();意向標誌並不在機器人

我可以通過使用FLAH象下面這樣實現它。

Intent intent = new Intent(secondActivity.this, firstSecond.class); 
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); 
startActivity(intent); 

但標誌只在後退按鈕這是目前的活動中。如果我點擊返回按鈕在我的手機國旗不起作用.....我該怎麼辦?任何幫助?

預先感謝

回答

0

覆蓋onBackPressed()並執行相同的代碼來代替:

Intent intent = new Intent(secondActivity.this, firstSecond.class); 
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); 
startActivity(intent);