android - onActivityResult gets called when Activity starts, not when its finished -
i wrote fragmentactivity tabs. when call additional activity (which use setting user-preferences) startactivityforresult (no differences if in fragmentactivity or in listfragment) method onactivityresult gets called when starts preference-activity, not when finish it, expect (again no differences if in fragmentactivity or in listfragment). after finish preference-activity method not called @ all.
my problem want refresh current tab (and set last used tab id) after finished preference activity , hoped able in onactivityresult method.
this class creating preference-activity:
public abstract class listfragmentbase<i> extends listfragment implements loadercallbacks<list<i>> { this method forwarding me preference activity inside class:
protected void forwardtopreferences(int currenttab){ intent intent = new intent(getactivity(), globalpreferencesactivity.class); getactivity().startactivityforresult(intent, 10); } this method gets called after calling method above not after finished called activity
@override public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); } this preference-activity:
public class globalpreferencesactivity extends activity { and inside class see how call 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(); } });
it bug of android
onactivityresult() called prematurely
and
why result startactivityforresult come before activity starts?
i don't know version use , if has been solved/corrected
Comments
Post a Comment