简体   繁体   中英

How to Restart Android Activity and still call onsaveinstancestate

I would like to know if there is a way to restart an activity from the same activity with

 finish();
 startActivity(getIntent());

and be able to call onSaveInstanceState to save data to be used on restart of the activity. I guess onSaveInstanceState will not be called since finish() is being used.

If there is any other efficient method please let me know.

Thanks Gokul

尝试调用Activity#recreate()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM