Android Life Cycle Question!

Asked 2 years ago, Updated 2 years ago, 27 views

I am studying APP. Let me ask you a question about the life cycle.

I understand that when you run the application, onCreate() runs only once. But if you turn on the application, press the home button, and touch the icon again to enter the app, onCreate() again I was able to see it run.

This leads to a situation in which objects created in onCreate() are re-new, and

Aren't you going to lose all the information that was on the original object because you re-designate the object?

If this situation is correct, is there any solution?

android

2022-09-22 18:29

1 Answers

OnSaveInstanceState() exists for that occasion.

https://developer.android.com/training/basics/activity-lifecycle/recreating?hl=ko

See Google's official document here.


2022-09-22 18:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.