B4A Library BottomNavigation

hongbii khaw

Member
Licensed User
Longtime User
Hi,
I got this error:
using library v1.1, b4a 6.5 beta
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
java.lang.NoSuchMethodError: android.support.v4.content.ContextCompat.getColor
at com.github.BottomNavigation.BottomNavigationView.onMeasure(BottomNavigationView.java:62)
at android.view.View.measure(View.java:16845)
at android.view.ViewGroup.measureChild(ViewGroup.java:5334)
at android.view.ViewGroup.measureChildren(ViewGroup.java:5304)
at anywheresoftware.b4a.BALayout.onMeasure(BALayout.java:64)
at android.view.View.measure(View.java:16845)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:340)
at android.view.View.measure(View.java:16845)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374)
at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:327)
at android.view.View.measure(View.java:16845)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:340)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2368)
at android.view.View.measure(View.java:16845)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2289)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1355)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1552)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1232)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6271)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:788)
at android.view.Choreographer.doCallbacks(Choreographer.java:591)
at android.view.Choreographer.doFrame(Choreographer.java:560)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:774)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5349)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:835)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:651)
at dalvik.system.NativeStart.main(Native Method)
 

Rochow

Member
Licensed User
Longtime User
Hello DonManfred,
With BottomNavigationEx.zip and BottomNavigationV1.1.zip, I got this error:

LogCat connected to: LGH6358df9da78
--------- beginning of system--------- beginning of main
Connected to B4A-Bridge (Wifi)
PackageAdded: package:b4a.example.BottomNavigation~i:*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 335)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at b4a.example.BottomNavigation.main._activity_create(main.java:335)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at b4a.example.BottomNavigation.main.afterFirstLayout(main.java:102)
at b4a.example.BottomNavigation.main.access$000(main.java:17)
at b4a.example.BottomNavigation.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5376)
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:908)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
... 16 more
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:1269)
at android.content.res.Resources.getDimension(Resources.java:577)
at com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView.<init>(BottomNavigationView.java:35)
at com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView.<init>(BottomNavigationView.java:87)
at com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView.<init>(BottomNavigationView.java:83)
at de.donmanfred.BottomNavigationViewWrapper._initialize(BottomNavigationViewWrapper.java:72)
... 20 more
 

™AsAs4242

Member
Licensed User
Longtime User
hi
no feature or way for select active tab?

i add 3 navigation bottom tab
i want select index 1(center tab) in start app
 

Cnrez

Member
Licensed User
Longtime User
hi don,

i try your example, and it works with library 1.0 but not working with library 1.1
can you tell me what is wrong ?
i really need "selectTab" feature which is only available in library version 1.1

the error is
B4X:
** Activity (main) Create, isFirst = true **
Error occurred on line: 33 (Main)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
   at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
   at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
   at java.lang.reflect.Method.invoke(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
   at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
   at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
   at java.lang.reflect.Method.invoke(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
   at b4a.example.BottomNavigation.main.afterFirstLayout(main.java:102)
   at b4a.example.BottomNavigation.main.access$000(main.java:17)
   at b4a.example.BottomNavigation.main$WaitForLayout.run(main.java:80)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:135)
   at android.app.ActivityThread.main(ActivityThread.java:5253)
   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:899)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.reflect.InvocationTargetException
   at java.lang.reflect.Method.invoke(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
   at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
   ... 20 more
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
   at android.content.res.Resources.getValue(Resources.java:1243)
   at android.content.res.Resources.getDimension(Resources.java:586)
   at com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView.<init>(BottomNavigationView.java:35)
   at com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView.<init>(BottomNavigationView.java:87)
   at com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView.<init>(BottomNavigationView.java:83)
   at de.donmanfred.BottomNavigationViewWrapper._initialize(BottomNavigationViewWrapper.java:72)
   ... 24 more
** Activity (main) Resume **

i attached sample project

thanks for your help
 

Attachments

  • BottomNavigation.zip
    6.5 KB · Views: 293

Cnrez

Member
Licensed User
Longtime User

Solved !

it turns out, the resource file in the example (dimens.xml) is missing one line that is used for library 1.1
B4X:
<dimen name="bottom_navigation_line_width">1dp</dimen>

old dimens.xml
B4X:
<resources>
    <dimen name="bottom_navigation_elevation">8dp</dimen>
    <dimen name="bottom_navigation_shadow_height">8dp</dimen>
    <dimen name="bottom_navigation_shadow_height_without_colored_background">4dp</dimen>
    <dimen name="bottom_navigation_min_width">104dp</dimen>
    <dimen name="bottom_navigation_max_width">168dp</dimen>
    <dimen name="bottom_navigation_height">56dp</dimen>
    <dimen name="bottom_navigation_icon">24dp</dimen>
    <dimen name="bottom_navigation_padding_top_active">5dp</dimen>
    <dimen name="bottom_navigation_padding_top_inactive">9dp</dimen>
    <dimen name="bottom_navigation_padding_top_inactive_without_text">16dp</dimen>
    <dimen name="bottom_navigation_padding_bottom">7dp</dimen>
    <dimen name="bottom_navigation_padding_left">12dp</dimen>
    <dimen name="bottom_navigation_padding_right">12dp</dimen>
    <dimen name="bottom_navigation_text_size_active">14sp</dimen>
    <dimen name="bottom_navigation_text_size_inactive">12sp</dimen>
</resources>

new dimens.xml
B4X:
<resources>
    <dimen name="bottom_navigation_elevation">8dp</dimen>
    <dimen name="bottom_navigation_shadow_height">8dp</dimen>
    <dimen name="bottom_navigation_shadow_height_without_colored_background">4dp</dimen>
    <dimen name="bottom_navigation_min_width">104dp</dimen>
    <dimen name="bottom_navigation_max_width">168dp</dimen>
    <dimen name="bottom_navigation_height">56dp</dimen>
    <dimen name="bottom_navigation_line_width">1dp</dimen>
    <dimen name="bottom_navigation_icon">24dp</dimen>
    <dimen name="bottom_navigation_padding_top_active">5dp</dimen>
    <dimen name="bottom_navigation_padding_top_inactive">9dp</dimen>
    <dimen name="bottom_navigation_padding_top_inactive_without_text">16dp</dimen>
    <dimen name="bottom_navigation_padding_bottom">7dp</dimen>
    <dimen name="bottom_navigation_padding_left">12dp</dimen>
    <dimen name="bottom_navigation_padding_right">12dp</dimen>
    <dimen name="bottom_navigation_text_size_active">14sp</dimen>
    <dimen name="bottom_navigation_text_size_inactive">12sp</dimen>
</resources>

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