Android開發零點起飛(第六章)筆記-Android-單純兩個Activity切換事件觸發筆記(6-5)
Android開發零點起飛(第六章)筆記-Android-單純兩個Activity切換事件觸發筆記(6-5)
Android-單純兩個Activity切換事件觸發筆記
#假設起始activity為ActivityLifeCylceActivity
<activity
android:name=”.ActivityLifeCylceActivity”
#在AndroidManifest.xml新增對應的activity tag
<activity android:name=”Two”></activity>
#從ActivityLifeCylceActivity跳轉到Two
Intent intent = new Intent();
intent.setClass(this, Two.class);
startActivity(intent);
[ ps. ActivityLifeCylceActivity(onPause)->2onCreate()->2onStart()->2onResume()->ActivityLifeCylceActivity(onStop) ]
#從Two跳轉到ActivityLifeCylceActivity
Intent intent = new Intent();
intent.setClass(this, ActivityLifeCylceActivity.class);
startActivity(intent);
[ ps. 2onPause()->ActivityLifeCylceActivity(onRestart)->ActivityLifeCylceActivity(onStart)->ActivityLifeCylceActivity(onResume)->2onStop() ]
#從Two跳轉到ActivityLifeCylceActivity+BACK鍵
[ ps. ActivityLifeCylceActivity(onPause)->2onRestart()->2onStart()->2onResume()->ActivityLifeCylceActivity(onStop)->ActivityLifeCylceActivity(onDestory)]