android - How to open the previous instance of an Activity and recreate it -
if call activity activity_b
, 1 of it's instances present in backstack, want go instance, removing activities in between, , recreate instance(to refresh content).
i tried:
intent intent = new intent(activity_a.this, activity_b.class); intent.addflags(intent.flag_activity_single_top); startactivity(intent); finish();
and in activity_b:
@override protected void onnewintent(intent intent) { super.onnewintent(intent); log.d("activity_b", "onnewintent"); //thought of refreshing content here. }
i never found above actions.
the best found flag_activity_single_top
not recreate activty, instead call onnewintent()
can refresh content.
but every time new instance of activity_b called.
what missing?
thank you
try using flag_activity_reorder_to_front instead. bring running instance of activity front if exists.
once activity comes foreground, it's onresume()
method called usual can refresh ui.
Comments
Post a Comment