Fixed it.
Code as of now:
Code as of now:
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Button1 As Button
Dim Button2 As Button
Dim Button3 As Button
Dim men As AHPopupMenu
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Load this particular layout.
Activity.LoadLayout("Screenresol")
'Initialize the popup menu.
men.Initialize("AC")
'3 options will be in th popup menu. Increase the last number to have more options.
For i = 1 To 3
Dim ai As AHActionItem
Dim bd As BitmapDrawable
Dim Filename, Text As String
'Select the id and set the icon (filename) and text for it.
Select i
Case 1
Filename = "star.png"
Text = "Favourite"
Case 2
Filename = "share.png"
Text = "Share"
Case 3
Filename = "sticky.png"
Text = "Sticky"
End Select
'Initialize a bitmap drawable (icon of option) and the action item (complete option with id, text and icon).
bd.Initialize(LoadBitmap(File.DirAssets, Filename))
ai.Initialize(i, Text, bd)
ai.Selected = True
'Make the third item sticky so they will not close the popup.
If i = 3 Then ai.Sticky = True
'Add the items to the popup menu.
men.AddActionItem(ai)
Next
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
'Event sub when item is pressed on.
Sub AC_Click (Position As Int, ActionItemID As Int)
Dim Action As AHActionItem
Action = men.getActionItem(Position)
ToastMessageShow(Action.Title & " pressed", False)
End Sub
Sub Button1_Click
'Shows a message.
ToastMessageShow("De Search button werkt.",False)
End Sub
Sub Button2_Click
'Open the popup menu when button is pressed.
men.Show(Sender)
End Sub
Sub Button3_Click
'Show a message.
ToastMessageShow("De Home button (het logo) werkt.", False)
End Sub
Last edited: