B4A Library AHNavigationDrawer - Native Google Navigation Drawer

Inman

Well-Known Member
Licensed User
Longtime User
The new version fixed the issue and works great. New arrow animation works well too. Couple of issues though.

1. The nineolds library file that is downloaded is nineoldandroids-2.4.0.jar but your library is expecting nineoldandroid-2.4.0.jar (without s before -). No issues, just need to rename the jar file or correct the XML file.

2. When a drawer slide is in progress, navdrawer_DrawerSlide (Position As Float, DrawerGravity As Int) has the values that are required to animate the arrow properly. But the DrawerGravity returned has a value of 8388611 for the drawer on the left while NavDrawer.GRAVITY_LEFT has a value of 3 which is same as Gravity.Left. Again, no big deal. Just need to make sure what value you are checking against, to identify the correct drawer (when there are multiple drawers).
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Hello,
during compile I've got this error "A referenced library is missing: nineoldandroid-2.4.0".
I read what you wrote about this library and I've done everything.

What's the matter?
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
See the previous post. The name nineoldandroids-2.4.0.jar needs the s removing from the name.
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Thanks.
Please, I can't understand what this function do:


B4X:
Sub GetNPDrawable(Name As String) As Object
Dim r As Reflector
Dim package As String
Dim id As Int
package = r.GetStaticField("anywheresoftware.b4a.BA", "packageName")
id = r.GetStaticField(package & ".R$drawable", Name)
r.Target = r.GetContext
r.Target = r.RunMethod("getResources")
Return r.RunMethod2("getDrawable", id, "java.lang.int")
End Sub
 

corwin42

Expert
Licensed User
Longtime User

corwin42

Expert
Licensed User
Longtime User

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Hello,
could you please help me with this log error?


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


java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/widget/DrawerLayout$LayoutParams;
    at de.amberhome.navdrawer.NavigationDrawer.Initialize2(NavigationDrawer.java:82)
    at de.amberhome.navdrawer.NavigationDrawer.Initialize(NavigationDrawer.java:67)
    at de.amberhome.NavDrawer.main._activity_create(main.java:292)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174)
    at de.amberhome.NavDrawer.main.afterFirstLayout(main.java:98)
    at de.amberhome.NavDrawer.main.access$100(main.java:16)
    at de.amberhome.NavDrawer.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:5834)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.widget.DrawerLayout$LayoutParams" on path: DexPathList[[zip file "/data/app/de.amberhome.NavDrawer-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    ... 17 more
    Suppressed: java.lang.ClassNotFoundException: android.support.v4.widget.DrawerLayout$LayoutParams
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 18 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
 
Last edited:

RandomCoder

Well-Known Member
Licensed User
Longtime User
Have you followed this advice from post 1...

This Library uses the android-support-v4.jar library which is part of the Android SDK. You have to install it with the Android SDK Manager. In the SDK Manager please add/download the "Extras/Android Support" package. Then you will need to copy the android-support-v4.jar file from <SDK root folder>\extras\android\support\v4 to your B4A custom libs folder!
 

Dave61

Member
Licensed User
Longtime User
Probably doing something stupid but here goes!

I implemented this Navigation Drawer in a project and it works fine. But feedback from users is that they want it to look more modern - i.e. material design.
This project uses Samsung tablets that we supply so they are all Lollipop minimum.
So, I tried changing the Manifest Editor my modifying these 2 lines:

<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="21"/>
SetApplicationAttribute(android:theme, "@style/MyAppTheme")

as mentioned in the 'Material Design 1 - Basics' tutorial (which I have working fine). I also added the resources of course & made them read-only.
However, in the resulting app, the drawer sits underneath the action bar instead of being integrated in it...screen dump attached.

Is there more I need to do to get this looking right? I was reading through the 2nd Material Design tutorial but, as I am only developing for Android 5, I am guessing (possibly incorrectly) that I don't need to worry about AppCompat and all the other steps involved in that tutorial to get controls looking correct for material design.
 

Attachments

  • tempFileForShare_2015-07-31-16-11-22.jpg
    89.1 KB · Views: 232

corwin42

Expert
Licensed User
Longtime User
No, this is not possible with a normal ActionBar. You have to use a ToolBar as your ActionBar.

See this stackoverflow post for a full explanation.
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Hello,
does it works on Android 5.1?
Because I click on the ActionBar button, but the drawer don't appear
 

corwin42

Expert
Licensed User
Longtime User
Hello,
does it works on Android 5.1?
Because I click on the ActionBar button, but the drawer don't appear
yes but there was a problem with old B4A versions. Be sure to use B4A 4.00 or above and use the Activity_ActionBarHomeClick event.
 
D

Deleted member 30048

Guest
hello, I get error if I use this library in conjunction with AdMob. The error that shows is the one shown in the picture.

I once had the same problem but I used a unknow version of android-support-v4 and worked well, but I no longer have that version.

How I can use this library and admob together?

Thanks!
 

Attachments

  • error.png
    166.5 KB · Views: 196

corwin42

Expert
Licensed User
Longtime User

This is not related to this library.

See here.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…