嗨,我創建一個應用tabactivity。但出於安全原因,我做出了改變,主屏幕會要求密碼,每當應用程序被移動到後臺,並重新開始或每當應用程序打開,因爲當一個活動調用stop()
然後我通過調用finish()
完成應用程序,它是加工。但問題是我無法看到用戶正在查看的最後一個標籤。我已經使用onsaveinstancestate()
這在這種情況下不起作用。我在這裏做什麼是錯的。有沒有其他方法呢?任何建議,歡迎 這是我的止損方法我的應用安全鎖
public void onStop()
{
super.onStop();
finish();
System.out.println("In the onStop() event");
}
this is my code in tabactivity
protected void onSaveInstanceState (Bundle outState){
outState.putInt("name",tabHost.getCurrentTab());
super.onSaveInstanceState(outState);}
protected void onRestoreInstanceState(Bundle outState){
super.onRestoreInstanceState(outState);
tabHost.setCurrentTab(outState.getInt("name"));
}
感謝您對我的幫助,我有疑問存儲在共享首選項將被檢索,即使活動後被殺害嗎? – Ghouse 2012-03-21 06:17:41
是的,共享首選項在應用程序啓動時保持不變。 – 2012-03-21 13:35:26