The difference between recreating an Activity with the recreate () method and startActivity (getIntent ())

I'm more or less new to Android programming

My question follows from this post .

As far as I can collect, there are basically two ways to restart the same activity that I am in:

a) Activity.recreate() [added after API 11]

b)

 Intent intent = getIntent(); finish(); startActivity(intent); 

How do these two work? Is there a difference in the process of recreating this activity?

I believe that there is a definite difference between the way these two recreate activity, because, I saw recreate() add default values ​​(undesirable?) To the views in my activity. In addition, recreate() starts a new action with a black pop-up view by default.

+8
android android-activity
source share
1 answer

Restore - (you can restore the activity state) This essentially leads to the same thread as when creating the Activity due to a configuration change - the current instance will go through its life cycle to onDestroy () and then create a new instance after it .

The recreate () method acts just like a configuration change, so the onSaveInstanceState () and onRestoreInstanceState () methods are also called.

Very interesting to read: http://developer.android.com/training/basics/activity-lifecycle/recreating.html

against

Done ActivityResult extends to those who launched you through onActivityResult (). and starts again as a new activity on top of the stack

+6
source share

All Articles