In Activitywhich launches PreferenceActivity, use startActivityForResultand onActivityResultto track when the user has completed PreferenceActivityand restarted the service there.
eg.
Wherever you start PreferenceActivity:
Intent prefIntent = new Intent(this, MyPreferenceActivity.class);
startActivityForResult(prefIntent, PREFS_UPDATED);
later in the same Activity:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (resultCode) {
case PREFS_UPDATED:
break;
...
}
}
source
share