Android Question AppCompat DSNavigationDrawer Problem

FrankDev

Active Member
Licensed User
Longtime User
hello
I wanted to use AppCompat navdrawer (DSNavigationDrawer) in a program where I already use the
AppCompat lib.
Unfortunately I always get the following problem

B4X:
--------- beginning of crash
--------- beginning of system
--------- beginning of main
android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class android.support.design.widget.NavigationView
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 69)
NavDrawer.Initialize2("NavDrawer", Activity, NavD
android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class android.support.design.widget.NavigationView
    at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
    at de.amberhome.objects.NavigationDrawerWrapper.Initialize2(NavigationDrawerWrapper.java:74)
    at testprog.example.main._activity_create(main.java:898)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
    at testprog.example.main.afterFirstLayout(main.java:102)
    at testprog.example.main.access$000(main.java:17)
    at testprog.example.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:815)
    at android.os.Handler.dispatchMessage(Handler.java:104)
    at android.os.Looper.loop(Looper.java:207)
    at android.app.ActivityThread.main(ActivityThread.java:5730)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class android.support.design.widget.NavigationView
    at android.view.LayoutInflater.createView(LayoutInflater.java:645)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
    ... 16 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at android.view.LayoutInflater.createView(LayoutInflater.java:619)
    ... 21 more
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
    at android.content.res.Resources.getValue(Resources.java:1544)
    at android.content.res.Resources.getColorStateList(Resources.java:1183)
    at android.content.Context.getColorStateList(Context.java:480)
    at android.support.v7.content.res.AppCompatResources.getColorStateList(AppCompatResources.java:65)
    at android.support.design.widget.NavigationView.createDefaultColorStateList(NavigationView.java:422)
    at android.support.design.widget.NavigationView.<init>(NavigationView.java:131)
    at android.support.design.widget.NavigationView.<init>(NavigationView.java:100)
    ... 23 more
sending message to waiting queue of uninitialized activity (subscribetotopics)

The example works for me without any problems

https://www.b4x.com/android/forum/threads/designsupport-additional-material-design-components.58893/

NavigationView1_0.zip

regards Frank
 

FrankDev

Active Member
Licensed User
Longtime User
this line causes the error

NavDrawer.Initialize2("NavDrawer", Activity, NavDrawer.DefaultDrawerWidth, NavDrawer.GRAVITY_START)
 
Upvote 0

FrankDev

Active Member
Licensed User
Longtime User
Problem found.

if in the manifest file in the theme e.g. the (color) entry

<item name="android:textColorPrimary">#484848</item>

then crashed DSNavigationDrawer.
(I also tested this with the demo example)
Someone an idea?

regards
Frank
 
Upvote 0
Top