Android 1.5 and 1.6 afer calling finish activity and home button weird behavior
Android Platform 1.5
- I open splash screen at the end i call finish() then i moved to browse page.
- At the browse page when i click on home button it hide the application.(b/c of Android's Multi tasking feature)
- When i go to Android's desktop launch application again it starts from splash screen.
Android Platform 1.6
- I open splash screen at the end i call finish() then i moved to browse page.
- At the browse page when i click on home button it hide the application.(b/c of Android's Multi tasking feature)
- When i go to Android's desktop launch application again it always starts from browse screen instead of splash screen why is that ?
I am putting all the data in onsave instance
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putString(WLConstants.READ_GPS, readGPS );
outState.putSerializable(WLConstants.SEARCH_CRITERIA, searchCriteria);
outState.putString(WLConstants.PARAM_WHERE, locationField.getText().toString());
outState.putBoolean(WLConstants.PARAM_NEAR_ME, rNearMe.isChecked());
super.onSaveInstanceState(outState);
Log.v(TAG, "onSaveInstanceState()");
}
i am extracting values from oncreate method
public void onCrea开发者_开发技巧te(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(savedInstanceState != null){
Log.v(TAG,"instace found");
}else{
Log.v(TAG,"instace not found");
}
}
"Instance found" never get called means it never returns bundle any reason why ?
I just tried this with an app on 1.5 and 1.6 devices that does the same thing — the LAUNCHER activity is a splash screen, which then starts the "main" Activity and calls finish()
on itself. The splash activity also has the noHistory
attribute set.
Anyway, on both devices, the main screen was shown as expected after pressing Home, then the launcher icon again.
I don't think Android provides any guarantees, however, about whether your process will still be alive when you start it from the launcher icon. So you could either start from where your task stack left off, or from the LAUNCHER activity.
But in your case, and in my experience just now, you should generally end up on your "browse" screen when hitting the launcher. Unless your system is ridiculously overloaded.
Anyway, about the instance state: have you tried seeing if calling super.onSaveInstanceState(outState)
first in the method makes any difference?
Also, note that this method is normally only called when the activity is killed off by the system; not just when it goes to the background. There shouldn't be anything for you to do in that case.
精彩评论