简体   繁体   中英

onCreate not getting called after finish()?

I have an activity A and an activity B. When I go from activity A to activity B, I use the following code:

Intent i = new Intent(A.this, B.class)
startActivity(i)

Now, when I want to return from activity B to activity A using finish() , the necessary method calls in my onCreate() method don't get called. Instead, my activity looks exactly how it is as when I left it...How do I get onCreate() to get called after using the finish() method?

I have tested, and even the onResume() method doesn't get called after the finish() method in activity B.

What is the problem?

OnCreate method will only be called when the activity is first created or re-created. Try to write a log in onResume or maybe post your code so we can inspect. Android provides full documentation of an Activity life cycle on their official website. You can look here Activity Life Cycle

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