layout - Android reset activity component state on navigation back -
i have 2 activities in application. in activity1, set configuration , modify state of component (ex: set button state disabled). , navigate activity2.
in activity2 stuff , @ end, finish activity , come activity1.
but in activity1, components state same when leave activity.
how reset components state valuesdeclared in xml file (layout) ?
when return previous activity result of calling finish() onactivityresult method called. can repopulate view desired state within method.
for example:
... intent result_intent = new intent(); setresult( activity.result_ok, result_intent ); finish(); } public void onactivityresult( int requestcode, int resultcode, intent data ) { setcontentview( r.layout.my_activity ); }
Comments
Post a Comment