B4A Library StdActionBar - Another ActionBar library

Discussion in 'Additional libraries, classes and official updates' started by Erel, Jan 16, 2014.

  1. Erel

    Erel Administrator Staff Member Licensed User

  2. woniol

    woniol Active Member Licensed User

    Looks like this problem. Do you think there is something you can do about it?
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Not with the native view. As you are creating many tabs you can use list navigation mode instead and it will work correctly.
     
  4. andrewj

    andrewj Active Member Licensed 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
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Yes. Though you do not need this library to achieve it. You can just add items with Activity.AddMenuItem3.
     
  6. andrewj

    andrewj Active Member Licensed User

    Thanks, that helps.
    Andrew
     
  7. metrick

    metrick Active Member Licensed User

    I have a problem on line
    Code:
    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
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Can you upload your project or a subset of it that reproduces this issue?
     
  9. metrick

    metrick Active Member Licensed User

    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: Jan 26, 2014
  10. wy328

    wy328 Member Licensed User

    great work! waiting so long for this kind of lib, a real native action bar lib! thanks!
     
  11. shashkiranr

    shashkiranr Active Member Licensed User

  12. barx

    barx Well-Known Member Licensed User

    OK I'm having a n00b moment. I have this:

    Code:
    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)

    Code:
    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
     
  13. Erel

    Erel Administrator Staff Member Licensed User

    If you want to catch the "logo" click event:
    Code:
    Sub ActionBar_ButtonClicked
    To catch the standard menu items:
    Code:
    Sub ActionHome_Click

    Sub ActionSearch_Click
     
    barx likes this.
  14. Augustinas Impalis

    Augustinas Impalis Member Licensed 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?
     
  15. Augustinas Impalis

    Augustinas Impalis Member Licensed User

    It's okay i sorted it only took me 3 hours haha
     
  16. Wembly

    Wembly Member Licensed 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.

    Code:
    SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light.DarkActionBar")
    Thanks
     
  17. jcesar

    jcesar Active Member Licensed 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.
     
  18. Wembly

    Wembly Member Licensed User

    Thanks Jcesar much appreciated will try that now :)
     
  19. Wembly

    Wembly Member Licensed 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:

    Code:
    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: Feb 7, 2014
  20. jcesar

    jcesar Active Member Licensed User

    It's working ?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice