Search code examples
androidpreferenceactivity

Execute something after call an Activity extends PreferenceActivity


When the user call a "Configuration" ítem of the app's menu and get back to the Main activity I want to execute something else ... I guess, I have to use startActivityForResult function correct?, but I have one question, the second Activity(PreferenceActivity / Configuration) does not has a "OK" or "CANCEL" button, so Where I have to put the finish() function to return to main activity ?, only the user get back to the main Activity when press back


Solution

  • Override onBackPressed() nad use setResult(...) method in second Activity