Reputation: 333
First of all I am a beginner at both Java and Android development
I need to call recreate()
when my app is opened back up from the minimized state. How can I achieve this?
Upvotes: 0
Views: 776
Reputation: 198
When the java application is opened for the first time, the onCreate() method is called. When the activity is "paused", the onResume() method is called to resume the activity. Additionally, when the application is "stopped", the onStart() method is called to resume the activity. It's important to understand the difference between the two when declaring what you want each method to perform.
Keep in mind that the onResume() and onStart() methods are generic and may not re-initialize components that were lost when the user closed the activity. So you would want something like this...
@Override
public void onResume() {
super.onResume();
// Initialize components here
}
@Override
public void onStart() {
super.onStart();
// Initialize components here
}
Upvotes: 2