android - Why my activity reCreate and not reStart -


i start activity this

 intent window = new intent(mcontext, popup.class);  window.addflags(intent.flag_activity_new_task |intent.flag_activity_reorder_to_front|intent.flag_activity_multiple_task);    mcontext.startactivity(window); 

my activity started , log

 oncreate  onstart  onresume 

now want stop activity use this

 movetasktoback(true); //i don't know if best way stop activity 

and log

onpause onstoped 

ondestroy not called

now want restart same activity use

   intent window = new intent(mcontext, popup.class);    window.addflags(intent.flag_activity_new_task |intent.flag_activity_reorder_to_front|intent.flag_activity_multiple_task);      mcontext.startactivity(window); 

here not restart activity make new one

 oncreate  onstart  onresume 

and activity in manifest

<activity         android:name=".activity.popup"         android:taskaffinity=".mydialog"         android:configchanges="orientation|screensize"         android:exported="true"         android:label="@string/app_name"         android:theme="@style/theme.floatingwindow.popup"         android:windowsoftinputmode="adjustresize|statealwayshidden"         tools:ignore="exportedactivity"          >    </activity> 

note ** if use launchmode singleinstance restart , not create new activity here problem cant instance same activity different data

dont add flag intent.flag_activity_new_task , add tag activity in manifest android:launchmode="singleinstance"


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -