Hi,
I am trying to use the AHActionBar library
My problem is when the app reads the "ab.Initialize("AB")" it is paused.
The code is taken from the AHActionbar example and I can not get it to work.
I am trying to use the AHActionBar library
My problem is when the app reads the "ab.Initialize("AB")" it is paused.
The code is taken from the AHActionbar example and I can not get it to work.
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.
'Some constants
Dim ID_ACTION_ADD As Int : ID_ACTION_ADD = 0
Dim ID_ACTION_DELETE As Int : ID_ACTION_DELETE = 0
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 ab As AHActionBar
Dim addIcon, deleteIcon As BitmapDrawable
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Load the layout of our activity.
Activity.LoadLayout("main")
'Load some icons to use as action items
addIcon.Initialize(LoadBitmap(File.DirAssets, "ic_tab_add.png"))
deleteIcon.Initialize(LoadBitmap(File.DirAssets, "ic_tab_remove.png"))
'Initialize the activity and set our defined background.
ab.Initialize("AB")
'You can change the width of an action item. 42dip is default
ab.ActionWidth = 42dip
'Add a home action item
'ab.addHomeAction(ID_ACTION_HOME, homeIcon)
'Add some action items
ab.addAction2(ID_ACTION_ADD, addIcon, "Share the content with your friends")
ab.addActionAt2(ID_ACTION_DELETE, deleteIcon, 0, "Refresh the content of the app")
'ab.addAction(ID_ACTION_OVERFLOW, overflowIcon)
'spColor_ItemClick(0, "Initialize")
'ab.TitleColor= Colors.Green
'Add the action bar to the activity.
Activity.AddView(ab, 0, 0, 100%x, 42dip)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub AB_ItemClicked(ItemID As Int)
'If the refresh action is pressed, show the progress indicator a few seconds.
Select ItemID
'Case ID_ACTION_REFRESH
' ab.ProgressBarVisible = True
' ab.SetActionVisibility(ID_ACTION_REFRESH, False)
' Timer1.Enabled = True
Case ID_ACTION_ADD
Msgbox("Home action pressed", "Item clicked")
Case ID_ACTION_DELETE
Msgbox("Share some content ...", "Item clicked")
'Case ID_ACTION_STAR
' Msgbox("Star action pressed", "Item clicked")
'Case ID_ACTION_OVERFLOW
' Msgbox("Open a Menu here (Perhaps with AHQuickAction popups)", "Item clicked")
End Select
End Sub
Attachments
Last edited: