Android Question I want to cancel Activity.AddMenuItem2

Tayfur

Well-Known Member
Licensed User
Longtime User
hello;

I create some manu items.
B4X:
Activity.AddMenuItem2("1 title","1deneme",LoadBitmap(File.DirAssets,"files-icon.png"))
        Activity.AddMenuItem2("11 title","11deneme",LoadBitmap(File.DirAssets,"files-icon.png"))
        Activity.AddMenuItem2("12 title","12deneme",LoadBitmap(File.DirAssets,"files-icon.png"))
So I want to, some times menu showable sometimes it not show.

B4X:
dim shw_menu as boolean
shw_menu=true ' or false
if shw_memu then
'... menu can show (disable=true)
' ????code ...(you said to me)
else
' --- menu con not show (disable=false)
' ????code ...(you said to me)
end if

How is can ??
 

DonManfred

Expert
Licensed User
Longtime User
How is can ??
You can not remove or disable a menuitem.

You need to use an Actionbar where you can place your own menu.
Look out for libraries which can add/change/disable/remove menuitems
For ex MSMaterialDrawer
 
Upvote 0

picenainformatica

Active Member
Licensed User
Longtime User
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean   
    If KeyCode = KeyCodes.KEYCODE_MENU Then
            if shw_memu then
                Return False
            else
                Return True
            end if
    Else
        Return false
    End If 
End Sub
 
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User
You can not remove or disable a menuitem.

You need to use an Actionbar where you can place your own menu.
Look out for libraries which can add/change/disable/remove menuitems
For ex MSMaterialDrawer

I willl look your lib.
thanks for your feedback.
 
Upvote 0
Top