Android Question Unknown type: menuitem Are you missing a library reference?

WofaCle

Member
Good day everyone please i have encounter problem with the below line of code help me fix it

B4X:
Private Sub More_Click
    Dim pop As PopupMenu
    Dim v As View
   
    v = Sender
   
    pop.Initialize("PopupMenu", v)
    'pop.AddMenuItem(1, "Share App", Null)
    'pop.AddMenuItem(2, "Rate App", Null)
    pop.AddMenuItem(3, "Anthem Audio", Null)
   
    pop.Show
End Sub


Sub PopupMenu_ItemClicked (Item As MenuItem)
    Select Item.Id
        Case ShareApp
'            Dim Intent As Intent
'            Intent.Initialize(Intent.ACTION_VIEW, "https://www.youtube.com/channel/UCCAK20OTGH7Tgd-ubETJd3g?view_as=subscriber")
'            StartActivity(Intent)
        Case RateApp
'            Dim Intent As Intent
'            Intent.Initialize(Intent.ACTION_VIEW, "https://www.google.com")
'            StartActivity(Intent)
        Case AnthemAudio
            Activity.LoadLayout("Music")
           
    End Select
   
End Sub
 
Last edited:

drgottjr

Expert
Licensed User
Longtime User
item.id's are ints, not strings: case 1, case 2, case 3. not case ShareApp, etc.
if you want the item's title, use item.title
 
Upvote 0

WofaCle

Member
Please it didn't work......
The problem is from "PopupMenu" and "Sub PopupMenu_ItemClicked (Item As MenuItem)"
There's a red line under it. But i have As PopupaMenu library in my libraries or is there other library i must use
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
the ASPopupMenu library uses ASPopupMenu_Item, not menuitem
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
Please attach your project if possible or an example with the same issue for us to check.
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
@WofaCle
If your idea is to use the ASPopUpMenu then I think that your code was quite messy and wrong.
But I am not familiar with ASPopUpMenu.
I just tried to make the menu work, as I guessed it was intended to.
Check if this can be a start for what you are trying to achieve.
But you need to check much more carefully the ASPopUpMenu example from the author thread (HERE) because you was missing all the initialization part and more, if you was trying to implement it.
Hope this can help a bit.
Take your time to study and understand. ;)
 

Attachments

  • App1_mod.zip
    35.3 KB · Views: 8
Upvote 0

WofaCle

Member
@WofaCle
If your idea is to use the ASPopUpMenu then I think that your code was quite messy and wrong.
But I am not familiar with ASPopUpMenu.
I just tried to make the menu work, as I guessed it was intended to.
Check if this can be a start for what you are trying to achieve.
But you need to check much more carefully the ASPopUpMenu example from the author thread (HERE) because you was missing all the initialization part and more, if you was trying to implement it.
Hope this can help a bit.
Take your time to study and understand. ;)
Okay Senior thank you so much am grateful
 
Upvote 0
Top