AHActionBar problem

mrossen

Active Member
Licensed User
Longtime User
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.

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

  • actionbar.zip
    8.5 KB · Views: 345
Last edited:

mrossen

Active Member
Licensed User
Longtime User
Yes I am using ver. 2.2 beta.

The strange thing is that the AHActionBar example working?

Mogens
 
Last edited:
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User
I asked because those of us who are not beta testers can't test your project...
 
Upvote 0

mrossen

Active Member
Licensed User
Longtime User
Hi. I have a log file if any can see the problem in it.

NOTE: attach of thread 'Binder Thread #3' failed
** Service (smsintercepter) Start **


** Service (smsintercepter) Start **


Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@44eb7118 (uid=10058 pid=656)


Client not active, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44f6cd30


Displayed activity b4a.example/.main: 1425 ms (total 1425 ms)


** Activity (main) Create, isFirst = true **


GC_FOR_MALLOC freed 8140 objects / 316488 bytes in 60ms


GC_FOR_MALLOC freed 11570 objects / 433856 bytes in 103ms


GC_FOR_MALLOC freed 11295 objects / 505336 bytes in 73ms


java.lang.ClassNotFoundException: b4a.example.R$dimen


at java.lang.Class.classForName(Native Method)


at java.lang.Class.forName(Class.java:235)
at java.lang.Class.forName(Class.java:182)
at de.amberhome.SimpleActionBar.RHelper.GetStaticField(RHelper.java:48)
at de.amberhome.SimpleActionBar.RHelper.getResourceId(RHelper.java:19)
at de.amberhome.SimpleActionBar.ActionBar.<init>(ActionBar.java:312)
at de.amberhome.SimpleActionBar.ActionBarWrapper.innerInitialize(ActionBarWrapper.java:86)
at anywheresoftware.b4a.objects.ViewWrapper.Initialize(ViewWrapper.java:43)
at de.amberhome.SimpleActionBar.ActionBarWrapper.Initialize2(ActionBarWrapper.java:79)
at de.amberhome.SimpleActionBar.ActionBarWrapper.Initialize(ActionBarWrapper.java:63)
at b4a.example.main._activity_create(main.java:329)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:165)
at b4a.example.main.afterFirstLayout(main.java:84)
at b4a.example.main.access$100(main.java:16)
at b4a.example.main$WaitForLayout.run(main.java:72)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: b4a.example.R$dimen


... 26 more
Caused by: java.lang.ClassNotFoundException: b4a.example.R$dimen in loader dalvik.system.PathClassLoader[/data/app/b4a.example-2.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
... 26 more
No package identifier when getting value for resource number 0x00000000
GC_FOR_MALLOC freed 14180 objects / 612712 bytes in 67ms


main_activity_create (B4A line: 54)


ab.Initialize("AB")
AndroidRuntime onExit calling exit(0)


Process b4a.example (pid 656) has died.
WIN DEATH: Window{4503f030 b4a.example/b4a.example.main paused=false}
WIN DEATH: Window{45050170 b4a.example/b4a.example.main paused=false}
Unexpected resume of com.android.launcher while already resumed in b4a.example
Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44f9cc68
GC_EXPLICIT freed 221 objects / 14536 bytes in 115ms


GC_EXPLICIT freed 101 objects / 4680 bytes in 130ms
 
Upvote 0

mrossen

Active Member
Licensed User
Longtime User
Hi,

I will use the class insted, but I would like to know why I not can get this to work.

The XML resources? That is proberly the problem because I dont know where to add them. Is it inside b4a or is it extern file?


Please adwise

Mogens
 
Upvote 0
Top