我是一個初學者的Android程序員,我似乎有一個問題: 我打開新activitys,與機器人 - 結束()關閉應用程序,而不是活性
Intent newGameIntent = new Intent(actionName);
startActivity(newGameIntent);
和萬物正常工作時,活動開始。 但是當我打電話完成()它不去往previus活動,它只是關閉應用程序(沒有錯誤或其他日誌messeges)
有沒有人有一個想法,爲什麼發生? 感謝您的時間!
的要求,這裏是更多的代碼(那我可能已經完全screwd了的東西): 第一個活動:
@Override
protected void onStop() {
super.onStop();
SplashScreen.sounds.releasSounds();
finish();
}
@Override
protected void onPause() {
super.onPause();
pauseActivity();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
gameLoop.resumeThread();
SplashScreen.sounds.resumeSounds();
}
private void pauseActivity() {
gameLoop.pauseThread();
SplashScreen.sounds.pauseBck();
}
和第一個活動調用秒活動
Intent newGameIntent = new Intent("com.YuvalApps.menus.NEWGAMEMENU");
startActivity(newGameIntent);
併爲秒活動
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
finish();
}
堆棧中是否還有其他活動? – Atrix1987
你是什麼意思?新活動有可能覆蓋前一個嗎? – Yuval3210
你應該看看這個:http://developer.android.com/guide/components/tasks-and-back-stack.html – Slickelito