Android application crashes when changing android:textColorPrimary -


i have 2 problems. first problem text appears white on emulator (android 6.0) while on phone it's grey (android 7.0). tried change textcolorprimary change application won't start anymore.

this styles.xml when crashes:

<!-- base application theme. --> <style name="apptheme" parent="theme.appcompat.light.noactionbar">     <!-- customize theme here. -->     <item name="colorprimary">@color/colorprimary</item>     <item name="colorprimarydark">@color/colorprimarydark</item>     <item name="coloraccent">@color/coloraccent</item>     <item name="android:windowactionbaroverlay">false</item>     <item name="android:textcolorprimary">#000000</item>  </style>  <style name="apptheme.appbaroverlay" parent="themeoverlay.appcompat.dark.actionbar" />  <style name="apptheme.popupoverlay" parent="themeoverlay.appcompat.light" />  </resources> 

activity_navigation.xml:

<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:opendrawer="start">  <include     layout="@layout/app_bar_navigation"     android:layout_width="match_parent"     android:layout_height="match_parent" />  <android.support.design.widget.navigationview     android:id="@+id/nav_view"     android:layout_width="wrap_content"     android:layout_height="match_parent"     android:layout_gravity="start"     android:fitssystemwindows="true"     app:headerlayout="@layout/nav_header_navigation"     app:menu="@menu/activity_navigation_drawer" />  </android.support.v4.widget.drawerlayout> 

navigationactivity.java:

package nl.prlg.morpoc;  import android.manifest; import android.app.fragment;  import android.app.fragmentmanager; import android.content.intent; import android.content.sharedpreferences; import android.content.pm.packagemanager; import android.os.bundle; import android.support.annotation.nonnull; import android.support.design.widget.navigationview; import android.support.v4.app.activitycompat; import android.support.v4.view.gravitycompat; import android.support.v4.widget.drawerlayout; import android.support.v7.app.actionbardrawertoggle; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.menu; import android.view.menuitem; import android.widget.toast;  import com.google.android.gms.maps.*; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions;  public class navigationactivity extends appcompatactivity     implements navigationview.onnavigationitemselectedlistener, onmapreadycallback {  private long backpressed; private googlemap mmap;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_navigation);     toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar);     setsupportactionbar(toolbar);      drawerlayout drawer = (drawerlayout) findviewbyid(r.id.drawer_layout);     actionbardrawertoggle toggle = new actionbardrawertoggle(             this, drawer, toolbar, r.string.navigation_drawer_open, r.string.navigation_drawer_close);     drawer.adddrawerlistener(toggle);     toggle.syncstate();      navigationview navigationview = (navigationview) findviewbyid(r.id.nav_view);     navigationview.setnavigationitemselectedlistener(this);      if (savedinstancestate == null) {         onnavigationitemselected(navigationview.getmenu().finditem(r.id.nav_list));         navigationview.getmenu().finditem(r.id.nav_list).setchecked(true);     } }  @override public void onbackpressed() {     drawerlayout drawer = (drawerlayout) findviewbyid(r.id.drawer_layout);     if (drawer.isdraweropen(gravitycompat.start)) {         drawer.closedrawer(gravitycompat.start);     } else if (getfragmentmanager().getbackstackentrycount() > 0) {         //super.onbackpressed();         getfragmentmanager().popbackstack();     } else if (backpressed + 2500 > system.currenttimemillis()) {         super.onbackpressed();     } else {         this.backpressed = system.currenttimemillis();         toast.maketext(this, "druk nog een keer op de terug knop om af te sluiten", toast.length_short).show();     } }  @suppresswarnings("statementwithemptybody") @override public boolean onnavigationitemselected(@nonnull menuitem item) {     // handle navigation view item clicks here.     int id = item.getitemid();      switch (id) {         case (r.id.nav_list): {             fragment fragment = new overviewfragment();             fragmentmanager fragmentmanager = getfragmentmanager();             fragmentmanager.begintransaction().replace(r.id.navcontent, fragment).commit();             break;         }         case (r.id.nav_map): {             mapfragment mapfragment = mapfragment.newinstance();             mapfragment.getmapasync(this);             fragmentmanager fragmentmanager = getfragmentmanager();             fragmentmanager.begintransaction().replace(r.id.navcontent, mapfragment).commit();             break;         }         case (r.id.nav_logout): {             sharedpreferences login = getsharedpreferences("login", 0);             sharedpreferences.editor editor = login.edit();             editor.remove("username");             editor.apply();              intent intent = new intent(this, mainactivity.class);             startactivity(intent);             finish();             break;         }     }      drawerlayout drawer = (drawerlayout) findviewbyid(r.id.drawer_layout);     drawer.closedrawer(gravitycompat.start);     return true; }  @override public boolean onprepareoptionsmenu(menu menu) {     return false; }     @override public void onmapready(googlemap googlemap) {     mmap = googlemap;      // add marker in sydney , move camera     latlng sydney = new latlng(-34, 151);     mmap.addmarker(new markeroptions().position(sydney).title("marker in sydney"));     mmap.movecamera(cameraupdatefactory.newlatlng(sydney));      mmap.getuisettings().setzoomcontrolsenabled(true);     mmap.getuisettings().setmylocationbuttonenabled(true);     mmap.getuisettings().settiltgesturesenabled(false);     mmap.getuisettings().setrotategesturesenabled(false);      enablelocation(); }  private void enablelocation() {     //always check permission     if (activitycompat.checkselfpermission(this,  manifest.permission.access_fine_location) != packagemanager.permission_granted) {         activitycompat.requestpermissions(this, new string[] {manifest.permission.access_fine_location}, 1);     } else {         mmap.setmylocationenabled(true);     } }  @override public void onrequestpermissionsresult(int requestcode, @nonnull string[] permissions, @nonnull int[] grantresults) {     switch (requestcode) {         case 1: {             if (grantresults.length > 0 && grantresults[0] ==  packagemanager.permission_granted) {                 enablelocation();             }         }     } } } 

app_bar_navigation.xml:

<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="nl.prlg.morpoc.navigationactivity">  <android.support.design.widget.appbarlayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:theme="@style/apptheme.appbaroverlay">      <android.support.v7.widget.toolbar         android:id="@+id/toolbar"         android:layout_width="match_parent"         android:layout_height="?attr/actionbarsize"         android:background="?attr/colorprimary"         app:popuptheme="@style/apptheme.popupoverlay" />  </android.support.design.widget.appbarlayout>  <!--<include layout="@layout/content_navigation" />--> <framelayout     android:id="@+id/navcontent"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:layout_margintop="?attr/actionbarsize" />  </android.support.design.widget.coordinatorlayout> 

i error: android.view.inflateexception: binary xml file line #16

full stacktrace:

07-28 13:41:09.164 27026-27026/nl.prlg.morpoc e/androidruntime: fatal exception: main                                                             process: nl.prlg.morpoc, pid: 27026                                                             java.lang.runtimeexception: unable start activity componentinfo{nl.prlg.morpoc/nl.prlg.morpoc.navigationactivity}: android.view.inflateexception: binary xml file line #16: binary xml file line #16: error inflating class android.support.design.widget.navigationview                                                                 @ android.app.activitythread.performlaunchactivity(activitythread.java:2416)                                                                 @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476)                                                                 @ android.app.activitythread.-wrap11(activitythread.java)                                                                 @ android.app.activitythread$h.handlemessage(activitythread.java:1344)                                                                 @ android.os.handler.dispatchmessage(handler.java:102)                                                                 @ android.os.looper.loop(looper.java:148)                                                                 @ android.app.activitythread.main(activitythread.java:5417)                                                                 @ java.lang.reflect.method.invoke(native method)                                                                 @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726)                                                                 @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616)                                                              caused by: android.view.inflateexception: binary xml file line #16: binary xml file line #16: error inflating class android.support.design.widget.navigationview                                                                 @ android.view.layoutinflater.inflate(layoutinflater.java:539)                                                                 @ android.view.layoutinflater.inflate(layoutinflater.java:423)                                                                 @ android.view.layoutinflater.inflate(layoutinflater.java:374)                                                                 @ android.support.v7.app.appcompatdelegateimplv9.setcontentview(appcompatdelegateimplv9.java:292)                                                                 @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:140)                                                                 @ nl.prlg.morpoc.navigationactivity.oncreate(navigationactivity.java:35)                                                                 @ android.app.activity.performcreate(activity.java:6237)                                                                 @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1107)                                                                 @ android.app.activitythread.performlaunchactivity(activitythread.java:2369)                                                                 @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476)                                                                  @ android.app.activitythread.-wrap11(activitythread.java)                                                                  @ android.app.activitythread$h.handlemessage(activitythread.java:1344)                                                                  @ android.os.handler.dispatchmessage(handler.java:102)                                                                  @ android.os.looper.loop(looper.java:148)                                                                  @ android.app.activitythread.main(activitythread.java:5417)                                                                  @ java.lang.reflect.method.invoke(native method)                                                                  @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726)                                                                  @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616)                                                               caused by: android.view.inflateexception: binary xml file line #16: error inflating class android.support.design.widget.navigationview                                                                 @ android.view.layoutinflater.createview(layoutinflater.java:645)                                                                 @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:764)                                                                 @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:704)                                                                 @ android.view.layoutinflater.rinflate(layoutinflater.java:835)                                                                 @ android.view.layoutinflater.rinflatechildren(layoutinflater.java:798)                                                                 @ android.view.layoutinflater.inflate(layoutinflater.java:515)                                                                 @ android.view.layoutinflater.inflate(layoutinflater.java:423)                                                                  @ android.view.layoutinflater.inflate(layoutinflater.java:374)                                                                  @ android.support.v7.app.appcompatdelegateimplv9.setcontentview(appcompatdelegateimplv9.java:292)                                                                  @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:140)                                                                  @ nl.prlg.morpoc.navigationactivity.oncreate(navigationactivity.java:35)                                                                  @ android.app.activity.performcreate(activity.java:6237)                                                                  @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1107)                                                                  @ android.app.activitythread.performlaunchactivity(activitythread.java:2369)                                                                  @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476)                                                                  @ android.app.activitythread.-wrap11(activitythread.java)                                                                  @ android.app.activitythread$h.handlemessage(activitythread.java:1344)                                                                  @ android.os.handler.dispatchmessage(handler.java:102)                                                                  @ android.os.looper.loop(looper.java:148)                                                                  @ android.app.activitythread.main(activitythread.java:5417)                                                                  @ java.lang.reflect.method.invoke(native method)                                                                  @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726)                                                                  @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616)                                                               caused by: java.lang.reflect.invocationtargetexception                                                                 @ java.lang.reflect.constructor.newinstance(native method)                                                                 @ android.view.layoutinflater.createview(layoutinflater.java:619)                                                                 @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:764)                                                                  @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:704)                                                                  @ android.view.layoutinflater.rinflate(layoutinflater.java:835)                                                                  @ android.view.layoutinflater.rinflatechildren(layoutinflater.java:798)                                                                  @ android.view.layoutinflater.inflate(layoutinflater.java:515)                                                                  @ android.view.layoutinflater.inflate(layoutinflater.java:423)                                                                  @ android.view.layoutinflater.inflate(layoutinflater.java:374)                                                                  @ android.support.v7.app.appcompatdelegateimplv9.setcontentview(appcompatdelegateimplv9.java:292)                                                                  @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:140)                                                                  @ nl.prlg.morpoc.navigationactivity.oncreate(navigationactivity.java:35)                                                                  @ android.app.activity.performcreate(activity.java:6237)                                                                  @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1107)                                                                  @ android.app.activitythread.performlaunchactivity(activitythread.java:2369)                                                                  @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476)                                                                  @ android.app.activitythread.-wrap11(activitythread.java)                                                                  @ android.app.activitythread$h.handlemessage(activitythread.java:1344)                                                                  @ android.os.handler.dispatchmessage(handler.java:102)                                                                  @ android.os.looper.loop(looper.java:148)                                                                  @ android.app.activitythread.main(activitythread.java:5417)                                                                  @ java.lang.reflect.method.invoke(native method)                                                                  @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726)                                                                  @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616)                                                               caused by: android.content.res.resources$notfoundexception: resource id #0x0                                                                 @ android.content.res.resources.getvalue(resources.java:1351)                                                                 @ android.content.res.resources.getcolorstatelist(resources.java:1045)                                                                 @ android.content.context.getcolorstatelist(context.java:475)                                                                 @ android.support.v7.content.res.appcompatresources.getcolorstatelist(appcompatresources.java:65)                                                                 @ android.support.design.widget.navigationview.createdefaultcolorstatelist(navigationview.java:422)                                                                 @ android.support.design.widget.navigationview.<init>(navigationview.java:148)                                                                 @ android.support.design.widget.navigationview.<init>(navigationview.java:100)                                                                 @ java.lang.reflect.constructor.newinstance(native method)                                                                  @ android.view.layoutinflater.createview(layoutinflater.java:619)                                                                  @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:764)                                                                  @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:704)                                                                  @ android.view.layoutinflater.rinflate(layoutinflater.java:835)                                                                  @ android.view.layoutinflater.rinflatechildren(layoutinflater.java:798)                                                                  @ android.view.layoutinflater.inflate(layoutinflater.java:515)                                                                  @ android.view.layoutinflater.inflate(layoutinflater.java:423)                                                                  @ android.view.layoutinflater.inflate(layoutinflater.java:374)                                                                  @ android.support.v7.app.appcompatdelegateimplv9.setcontentview(appcompatdelegateimplv9.java:292)                                                                  @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:140)                                                                  @ nl.prlg.morpoc.navigationactivity.oncreate(navigationactivity.java:35)                                                                  @ android.app.activity.performcreate(activity.java:6237)                                                                  @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1107)                                                                  @ android.app.activitythread.performlaunchactivity(activitythread.java:2369)                                                                  @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476)                                                                  @ android.app.activitythread.-wrap11(activitythread.java)                                                                  @ android.app.activitythread$h.handlemessage(activitythread.java:1344)                                                                  @ android.os.handler.dispatchmessage(handler.java:102)                                                                  @ android.os.looper.loop(looper.java:148)                                                                  @ android.app.activitythread.main(activitythread.java:5417)                                                                  @ java.lang.reflect.method.invoke(native method)                                                                  @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726)                                                                  @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616)  

so knows how fix white colored text?

edit: screenshot of white text: enter image description here

i think opacity of colors used may reason error. got same error , solved changing opacity of color. please try if setting opacity=255 or default value solved problem...


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -