Onactivityresult Isn't Called For Startactivityforresult
I have a MainActivity with an options menu with a 'settings' item. When I start the SettingsActivity, all works fine until I click the save button and try to finish the SettingsAct
Solution 1:
Try to set your mainActivity as
android:launchMode="singleTask"
in your AndroidManifest.
Solution 2:
Solution 3:
I believe it's because the launchMode
, review it in AndroidManifest
Try it with singleTop
http://developer.android.com/guide/topics/manifest/activity-element.html#lmode
[EDITED]
Do this change and tell me what happen when you tap in settings view.
@OverridepublicbooleanonOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.settings:
Intentintent=newIntent(this, SettingsActivity.class);
startActivityForResult(intent, ACTIVITY_CREATE);
break;
}
returnsuper.onOptionsItemSelected(item);
}
Solution 4:
I found the problem. I had a finish() at the end of MainActivity's onStop() function.
Post a Comment for "Onactivityresult Isn't Called For Startactivityforresult"