Hi
I am getting an error after I dim the menu in a local function so I can dynamically re-create.
I too dynamically create the menu.
Regards
John
I am getting an error after I dim the menu in a local function so I can dynamically re-create.
B4X:
Sub Process_Globals
Dim acChannels As AHQuickAction3D
end sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
' // menu's
acChannels.Initialize("ac_channels", acChannels.VERTICAL)
end if
end sub
Sub make_menus_acChannels
Dim i As Int, s As String
s = "SELECT ptt_users_channels.channel_id, ptt_channels.channel_name FROM ptt_users_channels " & _
"INNER JOIN ptt_channels ON ptt_users_channels.channel_id=ptt_channels.channel_id ORDER BY ptt_users_channels.channel_id"
' // get list of cases for current view
Dim rs As Cursor
rs = SQLDB.ExecQuery(s)
show_channel_count
If rs.RowCount = 0 Then
Return
End If
' // re-create the menu
Dim acChannels As AHQuickAction3D
For i = 0 To (rs.RowCount-1)
rs.Position = i
Dim ai As AHActionItem
Dim bd As BitmapDrawable
Dim Filename, Text As String
Filename = "walkie_talkie_white_24pxi.png"
Text = rs.GetInt("ptt_users_channels.channel_id") & "-" & rs.GetString("ptt_channels.channel_name")
' // Initialize a bitmap drawable and the action item
bd.Initialize(LoadBitmap(File.DirAssets, Filename))
ai.Initialize( rs.GetInt("ptt_users_channels.channel_id") , Text, bd)
ai.Selected = True
acChannels.AddActionItem(ai) <- ERROR HERE Null pointer exception
Next
End Sub
I too dynamically create the menu.
Regards
John