i have message menu in my action bar and it only shown inside Menu Activity and it will has an alert number for each message that hasn't been read yet, but every time i read my message the number won't change unless i close the application and open it again, how to make it can change the number after i read a message ? i am using back button to open Menu activity after opening message instead opening a new Menu Activity using intent
here is my code to change my action bar alert
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.actionbars, menu);
if (mPrefs.getUserType().equalsIgnoreCase("dosen")){
menu.findItem( R.id.chgpassword ).setVisible( false );
menu.findItem( R.id.exit ).setVisible( false );
} else {
requestNotif(new ApiCallback(){
@Override
public void onSuccess(Integer result){
//do stuff here with the list from the request
newNotif = result;
MenuItem item = menu.findItem(R.id.notif);
LayerDrawable icon = (LayerDrawable) item.getIcon();
Utils2.setBadgeCount(mContext, icon, newNotif);
}
});
}
return true;
}