I know it may sound silly, but I really cannot understand if there is a straightforward and standard way to understand when a user gets out from the preferences activity.
case R.id.menu_settings:
Intent i = new Intent(this, Pref.class); startActivity(i);
Toast.makeText(this, "test", Toast.LENGTH_SHORT).show();
updateData();
return true;
Obviously here the “test” Toast appears asynchronously, while the preferences window is still open. But in the preferences the user could change vital parameters that, to be applied, need updateData() to be called: how can I do? I’m sure that there’s a obvious way to do it, but I’m missing it….
Thank you.
You could use
startActivityforResultinstead of startActivity and show the toast inonActivityResult