Reload or Refresh an Activity in Android

by Sasikumar 2014-02-19 14:14:54

To reload/refresh an activity in android follow one of the following two methods:
<u>Method 1:</u>
Intent intent = getIntent(); //get the current activity
finish(); // finish the current activity
startActivity(intent); //start the activity as new by the reference

<u>Method 2:</u> This method will support only for API higher than API5
Intent intent = getIntent();
overridePendingTransition(0, 0);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
finish();
overridePendingTransition(0, 0);
startActivity(intent);

857
like
0
dislike
0
mail
flag

You must LOGIN to add comments