Reload activity in Android


Question

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?

1
196
6/26/2015 6:24:16 PM

Accepted Answer

You can Simply use

finish();
startActivity(getIntent());

to refresh an Activity from within itself.

469
6/26/2015 6:24:43 PM

for those who don't want to see that blink after recreate() method simply use

 finish();
 overridePendingTransition(0, 0);
 startActivity(getIntent());
 overridePendingTransition(0, 0);

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon