FATAL EXCEPTION on retrieving a Drawable or color only on Android < 4.0 -
i'm trying fix app , can't figure out what's problem. problem when run app on android version < 4.0 guess problem appcompat, have no idea how fix it. error when run this:
07-30 09:40:44.726 14081-14081/my.app.pag e/androidruntime﹕ fatal exception: main java.lang.runtimeexception: unable start activity componentinfo{my.app.pag/my.app.pag.mainactivity}: android.view.inflateexception: binary xml file line #2: error inflating class textview @ android.app.activitythread.performlaunchactivity(activitythread.java:1651) @ android.app.activitythread.handlelaunchactivity(activitythread.java:1667) @ android.app.activitythread.access$1500(activitythread.java:117) @ android.app.activitythread$h.handlemessage(activitythread.java:935) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:123) @ android.app.activitythread.main(activitythread.java:3687) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:507) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:842) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:600) @ dalvik.system.nativestart.main(native method) caused by: android.view.inflateexception: binary xml file line #2: error inflating class textview @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:587) @ android.view.layoutinflater.inflate(layoutinflater.java:386) @ android.view.layoutinflater.inflate(layoutinflater.java:320) @ my.app.pag.utils.slidingtablayout.populatetabstrip(slidingtablayout.java:207) @ my.app.pag.utils.slidingtablayout.setviewpager(slidingtablayout.java:166) @ my.app.pag.fragment.mainfragment.oncreateview(mainfragment.java:96) @ android.support.v4.app.fragment.performcreateview(fragment.java:1789) @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:955) @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1138) @ android.support.v4.app.backstackrecord.run(backstackrecord.java:740) @ android.support.v4.app.fragmentmanagerimpl.execpendingactions(fragmentmanager.java:1501) @ android.support.v4.app.fragmentactivity.onstart(fragmentactivity.java:551) @ it.seatpg.core.activity.coreactivity.onstart(coreactivity.java:119) @ my.app.pag.mainactivity.onstart(mainactivity.java:469) @ android.app.instrumentation.callactivityonstart(instrumentation.java:1129) @ android.app.activity.performstart(activity.java:3791) @ android.app.activitythread.performlaunchactivity(activitythread.java:1624) at android.app.activitythread.handlelaunchactivity(activitythread.java:1667) at android.app.activitythread.access$1500(activitythread.java:117) at android.app.activitythread$h.handlemessage(activitythread.java:935) at android.os.handler.dispatchmessage(handler.java:99) at android.os.looper.loop(looper.java:123) at android.app.activitythread.main(activitythread.java:3687) at java.lang.reflect.method.invokenative(native method) at java.lang.reflect.method.invoke(method.java:507) at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:842) at com.android.internal.os.zygoteinit.main(zygoteinit.java:600) at dalvik.system.nativestart.main(native method) caused by: android.content.res.resources$notfoundexception: resource not drawable (color or path): typedvalue{t=0x2/d=0x101030e a=-1} @ android.content.res.resources.loaddrawable(resources.java:1681) @ android.content.res.typedarray.getdrawable(typedarray.java:601) @ android.view.view.<init>(view.java:1961) @ android.widget.textview.<init>(textview.java:376) @ android.support.v7.widget.appcompattextview.<init>(appcompattextview.java:44) @ android.support.v7.widget.appcompattextview.<init>(appcompattextview.java:40) @ android.support.v7.internal.app.appcompatviewinflater.createview(appcompatviewinflater.java:103) @ android.support.v7.app.appcompatdelegateimplv7.createview(appcompatdelegateimplv7.java:802) @ android.support.v7.app.appcompatdelegateimplv7.oncreateview(appcompatdelegateimplv7.java:832) @ android.support.v4.view.layoutinflatercompatbase$factorywrapper.oncreateview(layoutinflatercompatbase.java:36) @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:563) at android.view.layoutinflater.inflate(layoutinflater.java:386) at android.view.layoutinflater.inflate(layoutinflater.java:320) at my.app.pag.utils.slidingtablayout.populatetabstrip(slidingtablayout.java:207) at my.app.pag.utils.slidingtablayout.setviewpager(slidingtablayout.java:166) at my.app.pag.fragment.mainfragment.oncreateview(mainfragment.java:96) at android.support.v4.app.fragment.performcreateview(fragment.java:1789) at android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:955) at android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1138) at android.support.v4.app.backstackrecord.run(backstackrecord.java:740) at android.support.v4.app.fragmentmanagerimpl.execpendingactions(fragmentmanager.java:1501) at android.support.v4.app.fragmentactivity.onstart(fragmentactivity.java:551) at my.app.core.activity.coreactivity.onstart(coreactivity.java:119) at my.app.pag.mainactivity.onstart(mainactivity.java:469) at android.app.instrumentation.callactivityonstart(instrumentation.java:1129) at android.app.activity.performstart(activity.java:3791) at android.app.activitythread.performlaunchactivity(activitythread.java:1624) at android.app.activitythread.handlelaunchactivity(activitythread.java:1667) at android.app.activitythread.access$1500(activitythread.java:117) at android.app.activitythread$h.handlemessage(activitythread.java:935) at android.os.handler.dispatchmessage(handler.java:99) at android.os.looper.loop(looper.java:123) at android.app.activitythread.main(activitythread.java:3687) at java.lang.reflect.method.invokenative(native method) at java.lang.reflect.method.invoke(method.java:507) at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:842) at com.android.internal.os.zygoteinit.main(zygoteinit.java:600) at dalvik.system.nativestart.main(native method)
the code in fragment (in oncreateview) this:
viewgroup root = (viewgroup) inflater.inflate(r.layout.fragment_main, container, false); viewpager pager = (viewpager) root.findviewbyid(r.id.pager); fragmentmanager fm = getchildfragmentmanager(); mainpageradapter adapter = new mainpageradapter(fm, getactivity(), recentwhere, recentwhat); pager.setadapter(adapter); // pager.setoffscreenpagelimit(2); // pager.setcurrentitem(page); slidingtablayout slidingtablayout = (slidingtablayout) root .findviewbyid(r.id.sliding_tabs); slidingtablayout.setcustomtabview(r.layout.custom_tab, 0); slidingtablayout.setbackgroundcolor(getresources().getcolor(r.color.pb_blue)); slidingtablayout.setdistributeevenly(true); slidingtablayout.setviewpager(pager); slidingtablayout .setcustomtabcolorizer(new slidingtablayout.tabcolorizer() { @override public int getindicatorcolor(int position) { return getresources().getcolor(r.color.pb_white); } });
my gradle build one:
android { compilesdkversion 22 buildtoolsversion "21.1.2" defaultconfig { minsdkversion 9 targetsdkversion 22 } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.google.android.gms:play-services-location:7.5.0' compile 'com.google.android.gms:play-services-analytics:7.5.0' compile 'io.gsonfire:gson-fire:1.0.1' compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.facebook.android:facebook-android-sdk:4.1.0' compile files('libs/cardview-v7.jar') compile files('libs/core-2.13.42.jar') compile files('libs/recyclerview-v7.jar') compile files('libs/simple-xml-2.7.jar') compile files('libs/universal-image-loader-1.9.1.jar') compile files('libs/googleconversiontrackingsdk-2.2.2.jar') compile project(':adobemobilelibrary-4.4.1') compile filetree(include: ['*.jar'], dir: 'libs') compile files('libs/adagiosdk_2.6.1.jar') compile 'com.google.code.gson:gson:2.2.4' compile 'com.android.support:design:22.2.0' }
this xml of fragment
<my.app.pag.slideup.slidinguppanellayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/sliding_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="bottom" app:shadowheight="4dp" > <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <my.app.pag.utils.slidingtablayout android:id="@+id/sliding_tabs" android:layout_width="match_parent" android:layout_height="wrap_content" /> <android.support.v4.view.viewpager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="0px" android:layout_weight="1" > </android.support.v4.view.viewpager> </linearlayout> <linearlayout android:id="@+id/grid_container" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingtop="10dp" > <gridview android:id="@+id/grid_view_services" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:choicemode="singlechoice" android:gravity="center" android:numcolumns="3" android:stretchmode="columnwidth" /> </linearlayout> </my.app.pag.slideup.slidinguppanellayout>
i didn't find problem in xml printed in error log... please find it?
what's possible solution?
thanks
try passing textview id second parameter function. slidingtablayout.setcustomtabview(r.layout.custom_tab, 0).
Comments
Post a Comment