in my app I have a refresh button. clicking on it it rotates (animation) while the fragment is updating. suppose I navigate from the given fragment to another and then back. Is there any possibility when I navigate back the refresh Menu Item being clicked automatically without pressing on it.
menu item onclick method
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_refresh:
item.setActionView(getAnimation());
getCurrency(code,item);
mViewpager.setVisibility(View.INVISIBLE);
Log.i("TAG", "refresh pressed =>");
return true;
}
// Handle your other action bar items...
return super.onOptionsItemSelected(item);
}
I want this code to execute when navigating back without pressing the menu Item