我有以下工作流程的活動時:爲什麼的onStop()進行的onCreate()之後調用開始內onActivityResult()
- startActivityForResult(活性1)
- 完成()呼籲活性1(推時按鈕)
- onActivityResult()==> startActivityForResult(活性2)
===> Activity2.onCreate()被Activity1.onStop之前調用()
爲什麼我有這個?
被修改:
下面是代碼:
1- MainActivity.java
// On click on a button
public void start(View view) {
Intent activityIntent = new Intent(this, Activity2.class);
startActivityForResult(activityIntent, 0);
}
protected void onActivityResult(int requestCode,
int resultCode,
Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Intent activityIntent = new Intent(this, Activity3.class);
startActivityForResult(activityIntent, 0);
}
2- Activity2.java
// A button to finish the activity
public void stop(View view) {
finish();
}
@Override
protected void onStop() {
super.onStop();
}
3- Activity3.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activity3);
}
你能分享一些代碼嗎?另外,onPause總是在活動更改時調用onStop,而不是。 – jasonflaherty 2013-02-15 15:56:37
http://developer.android.com/reference/android/app/Activity.html – jasonflaherty 2013-02-15 15:59:45
我的問題是爲什麼Activity2.onCreate()在Activity1.onStop()之前調用? – 2013-02-15 16:01:57