My app features a hamburger menu (three stacks that opens the side Menu, see below). It works great most of the time, but sometimes on the device as well as on simulator it disappears.

To make it reappear again, the user has to rotate the screen, but it does not prevent the hamburger menu to disappear again. Another screen rotation makes it appear again.
To be clear when it happens, there is no way to open the side menu even if the user clicks on the location where the hamburger icon used to be.
The issue is hard to reproduce, sometimes it happens in series, sometimes it does not happen at all (the hamburger icon and menu stay there). So I am looking for clues on where to look at to solve the problem.
Any hint appreciated,
I had a similar issue in the past too, even with background transparency set to 255 and it wasn't consistent.
My solution was to use a button as Hamburger menu and stay away from using the theme one.
Firstly I hide the default hamburger menu button by adding theme constant hideLeftSideMenuBool and set it to true.
I have a method for creating Material Icon base on size:
public static FontImage materialIcon(char charCode, int size, int color) {
Font fnt = Font.createTrueTypeFont("native:MainLight", "native:MainLight").derive(Display.getInstance().convertToPixels(size), Font.STYLE_PLAIN);
Style s = new Style(color, 0, fnt, (byte) 0);
FontImage fm = FontImage.createMaterial(charCode, s);
fm.setPadding(0);
return fm;
}
Lastly, I added my custom menu command and set it to open the sidemenu, then place it on the left bar:
Command cmdMenu = Command.create("", materialIcon(FontImage.MATERIAL_MENU, 5), evt -> getToolbar().openSideMenu());
if (!Display.getInstance().isTablet() && !Toolbar.isPermanentSideMenu()) {
getToolbar().addCommandToLeftBar(cmdMenu);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With