For example, if i have a button called "Restart", and I want to launch again the onCreate where the app is actually.
Asked
Active
Viewed 221 times
5 Answers
4
If you want to restart the activity you're in, try this:
Intent intent = getIntent();
overridePendingTransition(0, 0);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
finish();
startActivity(intent);
Voicu
- 15,158
- 9
- 54
- 66
0
Finish the Activity and launch it again with an Intent, but I don't really see why you would want to do that.
SimonSays
- 10,606
- 5
- 40
- 51
0
If you are developing for Honeycomb (API 11) or later you can call recreate()
user2340612
- 9,145
- 4
- 40
- 63
0
You may want to use the onPaint event with invalidate() if all you want to do is refresh.
user2347763
- 461
- 2
- 10