B4A Library StdActionBar - Another ActionBar library

woniol

Active Member
Licensed User
Longtime User
Looks like this problem. Do you think there is something you can do about it?
 

andrewj

Active Member
Licensed User
Longtime User
Hi,
Does this support the model where the action bar has a couple of visible items, and the rest go to a drop-down menu from three dots in the top right corner?
Thanks
Andrew
 

metrick

Active Member
Licensed User
Longtime User
I have a problem on line
B4X:
bar.Initialize("bar")
bar.NavigationMode =  bar.NAVIGATION_MODE_TABS  '<- this is line 78 copied from Erel Example codes.
and here is the logs:
Error occurred on line: 78 (owneradmin)
java.lang.NullPointerException
at anywheresoftware.b4a.objects.StdActionBar.setNavigationMode(StdActionBar.java:48)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:485)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:229)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at com.memoryforever.metsoft.owneradmin.afterFirstLayout(owneradmin.java:98)
at com.memoryforever.metsoft.owneradmin.access$100(owneradmin.java:16)
at com.memoryforever.metsoft.owneradmin$WaitForLayout.run(owneradmin.java:76)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5171)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:564)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
--------- beginning of /dev/log/system
 

metrick

Active Member
Licensed User
Longtime User
Can you upload your project or a subset of it that reproduces this issue?
I have copy and paste the working codes sample from page 1 include sample layouts 0, 1, 2 and commented out all my codes. I still get the same problems.

I have create a new module with new name copy and paste the code to the new module and it's working now...
 
Last edited:

wy328

Member
Licensed User
Longtime User
great work! waiting so long for this kind of lib, a real native action bar lib! thanks!
 

barx

Well-Known Member
Licensed User
Longtime User
OK I'm having a n00b moment. I have this:

B4X:
    ActionBar.Initialize("ActionBar")
   
    Activity.AddMenuItem3("Home", "ActionHome", LoadBitmap(File.DirAssets, "home_icon.png"), True)
    Activity.AddMenuItem3("Search", "ActionSearch", LoadBitmap(File.DirAssets, "search_icon.png"), True)

and the to catch the menu item presses I have (only home so far)

B4X:
Sub ActionHome_ButtonClicked
    Log("click")
    wvContent.LoadUrl(HomeURL)
End Sub

The click is there just to see if the event is triggering. Nothing is happening. What am I missing? lol
 

Augustinas Impalis

Member
Licensed User
Longtime User
How do i add another tab? i have created another layout and did what i think i needed to do which was Addtab and LoadLayout but i keep getting this message "java.lang.ArrayIndexOutOfBoundsException: length=3; index=3" whats missing?
 

Wembly

Member
Licensed User
Longtime User
Hi Erel,

I've been struggling to understand how using the Google link & manifest editor to change the background colour of the action bar and/or split action bar.

Please could you or anyone else who has the knowledge be generous to post an example how to do this? I think this will be of great benefit to many users of this action bar library.

I can change the theme of the action bar from holo light to holo dark but want to be able to specify my own colours.

B4X:
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light.DarkActionBar")

Thanks
 

jcesar

Active Member
Licensed User
Longtime User
To customize the actionbar color and others properties you can use the Android ActionBar style Generator to create your actionbar layouts, generate the ressources files, import into your b4a project and change the android manifest to use your new theme.

Works for me.
 

Wembly

Member
Licensed User
Longtime User
Jcesar - can you please confirm exactly how you 'import' the resource files.

I've used the ActionBar Style Generator as suggested copied the various drawable folders to 'res' folder and set them to read-only.

copied the .xml from the values folder in the zip file - renamed to themes.xml and placed it in the res\xml folder as read-only too.

UPDATE ALL WORKING NOW - FIX - themes.xml should be in folder res\values

I called the theme 'Test' in the generator so in the manifest editor I entered the following:

B4X:
SetApplicationAttribute(android:theme, "@style/Theme.Test")

But I'm getting the error :

AndroidManifest.xml:14: error: Error: No resource found that matches the given name (at 'theme' with value '@style/Theme.Test').

Please can you point me in the right direction?

Cheers
 
Last edited:

jcesar

Active Member
Licensed User
Longtime User

It's working ?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…