last day (15 days later) » 

9:13 PM
1
Q: Android toolbar menu - change dynamically

AlonI have group inside menu.xml and I try to change the visibility of the group. //in the onCreate myToolbar = (Toolbar) findViewById(R.id.my_toolbar); setSupportActionBar(myToolbar); @Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); men...

 
Can you provide screenshots of what you mean. It's a bit difficult to visualize what you mean
Or better yet, it might be better to hide the menu entries individually: menu.findItem(R.id.menuItem1).setVisible(showGroup); I think the group visibility only works when the overflow menu is opened. If that's what you meant, then I can add it in as an answer so you may accept it.
 
@Passerby this is the same as before...
only when the app change the focus from the activity and return every thing start to works as expected
 
I tested your menu.xml and code and that seems to work okay for me. What version of the com.android.support:appcompat-v7 are you running? What's your Android version, and your testing device?
 
I am testing on the emulator android .6. com.android.support:appcompat-v7:24.1.1
 
@Alon Try updating to 'com.android.support:appcompat-v7:24.2.0' and see if it still shows up
 
9:15 PM
hello, Now when I test it on my device (redmi note 3 android 5.1) it works..
but not in the emulator
 
Was this before/after updating appcompat?
 
before
 
I'm testing against Android 7 in the emulator.
Try against 24.2.0 and see if that fixes it.
 
Ok
 
9:31 PM
I cant update.. everything crash. Thanks for the help I think that I will find image for emulator that it will work.. maybe android 7
 
No worries dude. Good luck. Keep me updated if you find a fix
 
Thanks
 

last day (15 days later) »