I have Activity with Action Which have a refresh icon in OnCreateOption Menu.I want to reload my current Activity On click this Icon Click.But I don't know to use here click event.How to resolve this.
Asked
Active
Viewed 603 times
-1
-
Look up `onOptionsItemClick()` – Shaishav Aug 06 '16 at 05:35
-
1Possible duplicate of [Reload activity in Android](http://stackoverflow.com/questions/3053761/reload-activity-in-android) – Jitesh Prajapati Aug 06 '16 at 05:43
1 Answers
1
Override onOptionsItemSelected
method like this way:
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
Intent intent = new Intent();
switch (item.getItemId()) {
case R.id.mnuRefresh: // your menu item id
reCreate();
break;
}
return false;
}
There is a good example here :
https://stackoverflow.com/a/7480103/2724418