I have one main activity and one preference. In my first action, I call the menu and go to the preference function by calling startActivityForResult.
case R.id.settings:
startActivityForResult(new Intent(this, SettingsActivity.class), LAUNCH_SETTINGS);
return true;
Then I change the settings and want to return to the main activity and see the main actions with the new settings. In the onPause () method, do the following (as I understood correctly, this method will be called when I click the "Back" button, right?)
@Override
protected void onPause() {
super.onPause();
setResult(RESULT_OK, new Intent(this, MainActivity.class));
finish();
}
About the main activity
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == LAUNCH_SETTINGS) {
if (resultCode == RESULT_OK) {
new RefreshList().execute(ACTION_SELECT);
Log.d(TAG, "On activity result");
}
}
}
But my acyncTask is not called or printed. How can I do it right? Thank!
source
share