android - binary xml error in pagersliding tab script -
my xml file following impotred library github .i want 2 tabs showing events.
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#f5f5f5" > <com.astuetz.viewpager.extensions.pagerslidingtabstrip android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="48dip" /> <android.support.v4.view.viewpager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@id/tabs" > </android.support.v4.view.viewpager> </relativelayout>
my fragmnet this,in java code have set view pager tabs it,s not working please me in this.
package com.example.mindwareuae; import com.astuetz.pagerslidingtabstrip; import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; import android.os.bundle; import android.support.v4.app.fragmentpageradapter; import android.support.v4.view.viewpager; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; public class eventfragment extends fragment { fragmentmanager fm; private viewpager viewpager; private eventadapter mfragmentpageadapter; pagerslidingtabstrip mpagerslidingtabstrip; view rootview; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { rootview = inflater.inflate(r.layout.fragment_event, container); mfragmentpageadapter = new eventadapter(fm); viewpager = (viewpager) rootview.findviewbyid(r.id.pager); mpagerslidingtabstrip = (pagerslidingtabstrip)rootview.findviewbyid(r.id.tabs); viewpager.setadapter(mfragmentpageadapter); mpagerslidingtabstrip.setviewpager(viewpager); //mpagerslidingtabstrip.setonpagechangelistener(null); return rootview; } class eventadapter extends fragmentpageradapter { public eventadapter(fragmentmanager fm) { super(fm); } @override public fragment getitem(int arg0) { // todo auto-generated method stub switch (arg0) { case 0: return new upcomingeventfragment(); case 1: return new pasteventfragment(); default: return null; } } @override public int getcount() { return 2; } @override public charsequence getpagetitle(int position) { switch (position) { case 0: return "upcommingevent"; case 1: return "pastevent"; default: break; } return super.getpagetitle(position); } } }
and logcat showing following error,whai binary xml error. not able understand whyit's showing error.
11-27 01:02:11.273: e/androidruntime(1321): fatal exception: main 11-27 01:02:11.273: e/androidruntime(1321): process: com.example.mindwareuae, pid: 1321 11-27 01:02:11.273: e/androidruntime(1321): android.view.inflateexception: binary xml file line #10: error inflating class com.astuetz.viewpager.extensions.pagerslidingtabstrip 11-27 01:02:11.273: e/androidruntime(1321): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:707) 11-27 01:02:11.273: e/androidruntime(1321): @ android.view.layoutinflater.rinflate(layoutinflater.java:755) 11-27 01:02:11.273: e/androidruntime(1321): @ android.view.layoutinflater.inflate(layoutinflater.java:492) 11-27 01:02:11.273: e/androidruntime(1321): @ android.view.layoutinflater.inflate(layoutinflater.java:397) 11-27 01:02:11.273: e/androidruntime(1321): @ android.view.layoutinflater.inflate(layoutinflater.java:353) 11-27 01:02:11.273: e/androidruntime(1321): @ com.example.mindwareuae.eventfragment.oncreateview(eventfragment.java:27) 11-27 01:02:11.273: e/androidruntime(1321): @ android.support.v4.app.fragment.performcreateview(fragment.java:1786) 11-27 01:02:11.273: e/androidruntime(1321): @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:947) 11-27 01:02:11.273: e/androidruntime(1321): @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1126) 11-27 01:02:11.273: e/androidruntime(1321): @ android.support.v4.app.backstackrecord.run(backstackrecord.java:739) 11-27 01:02:11.273: e/androidruntime(1321): @ android.support.v4.app.fragmentmanagerimpl.execpendingactions(fragmentmanager.java:1489) 11-27 01:02:11.273: e/androidruntime(1321): @ android.support.v4.app.fragmentmanagerimpl$1.run(fragmentmanager.java:454) 11-27 01:02:11.273: e/androidruntime(1321): @ android.os.handler.handlecallback(handler.java:733) 11-27 01:02:11.273: e/androidruntime(1321): @ android.os.handler.dispatchmessage(handler.java:95) 11-27 01:02:11.273: e/androidruntime(1321): @ android.os.looper.loop(looper.java:136) 11-27 01:02:11.273: e/androidruntime(1321): @ android.app.activitythread.main(activitythread.java:5017) 11-27 01:02:11.273: e/androidruntime(1321): @ java.lang.reflect.method.invokenative(native method) 11-27 01:02:11.273: e/androidruntime(1321): @ java.lang.reflect.method.invoke(method.java:515) 11-27 01:02:11.273: e/androidruntime(1321): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) 11-27 01:02:11.273: e/androidruntime(1321): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:595) 11-27 01:02:11.273: e/androidruntime(1321): @ dalvik.system.nativestart.main(native method) 11-27 01:02:11.273: e/androidruntime(1321): caused by: java.lang.classnotfoundexception: didn't find class "com.astuetz.viewpager.extensions.pagerslidingtabstrip" on path: dexpathlist[[zip file "/data/app/com.example.mindwareuae-2.apk"],nativelibrarydirectories=[/data/app-lib/com.example.mindwareuae-2, /system/lib]] 11-27 01:02:11.273: e/androidruntime(1321): @ dalvik.system.basedexclassloader.findclass(basedexclassloader.java:56) 11-27 01:02:11.273: e/androidruntime(1321): @ java.lang.classloader.loadclass(classloader.java:497) 11-27 01:02:11.273: e/androidruntime(1321): @ java.lang.classloader.loadclass(classloader.java:457) 11-27 01:02:11.273: e/androidruntime(1321): @ android.view.layoutinflater.createview(layoutinflater.java:559) 11-27 01:02:11.273: e/androidruntime(1321): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:696) 11-27 01:02:11.273: e/androidruntime(1321): ... 20 more pleaese me in struct long time in advance
the problem here imported different package name in activity , xml. make sure "com.astuetz.viewpager.extensions.pagerslidingtabstrip" correctly imported in activity.
hope friend :)
Comments
Post a Comment