Is it a good practice to reload an Activity
in Android?
What would be the best way to do it? this.finish
and then this.startActivity
with the activity Intent
?
Is it a good practice to reload an Activity
in Android?
What would be the best way to do it? this.finish
and then this.startActivity
with the activity Intent
?
Android includes a process management system which handles the creation and destruction of activities which largely negates any benefit you'd see from manually restarting an activity. You can see more information about it at Application Fundamentals
What is good practice though is to ensure that your onPause and onStop methods release any resources which you don't need to hold on to and use onLowMemory to reduce your activities needs to the absolute minimum.
In an activity you can call
recreate()
to "recreate" the activity (API 11+)