I wrote FragmentActivity with some tabs. when I call an additional action (which I use to configure user settings) with startActivityForResult (no difference if it is in FragmentActivity or in ListFragment), the onActivityResult method is called when I start this preference activity, but not when I finish it since I would expect this (again, no differences if it is in a FragmentActivity or in a ListFragment). after I finish the preference operation, this method is not called at all.
my problem is that I want to update the current tab (and set the last used tab id) after I have finished the preference activity, and I was hoping I could do it in the onActivityResult method.
this is a class that creates preference activity:
public abstract class ListFragmentBase<I> extends ListFragment implements LoaderCallbacks<List<I>> {
this is a method that redirects me to preference activity inside this class:
protected void forwardToPreferences(int currentTab){ Intent intent = new Intent(getActivity(), GlobalPreferencesActivity.class); getActivity().startActivityForResult(intent, 10); }
this is a method that is called after calling the method above, but not after I finished the called activity
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); }
this preference is activity:
public class GlobalPreferencesActivity extends Activity {
and inside this class you see what I call the finish method:
TextView confirmSettings = (TextView) view.findViewById(R.id.confirm_settings); confirmSettings.setTextSize(PreferenceHelper.getSizeHeader(getApplicationContext())); confirmSettings.findViewById(R.id.confirm_settings).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(BaseFragmentActivity.lastActivity != null){ BaseFragmentActivity.lastActivity.onRefreshData(); } ComponentName callingActivity = getCallingActivity(); GlobalPreferencesActivity.this.finish(); } });
richard
source share