android.view.InflateException: Binary XML file line #2: Error inflating class <unknown> in ListFragment with sliding tabs -


my logcat follows:

09-30 01:02:26.708    2545-2545/? d/androidruntime﹕ shutting down vm 09-30 01:02:26.709    2545-2545/? e/androidruntime﹕ fatal exception: main     process: com.example.swati.newsaggregator, pid: 2545 android.view.inflateexception: binary xml file line #2: error inflating class <unknown>         @ android.view.layoutinflater.createview(layoutinflater.java:633)         @ com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:55)         @ android.view.layoutinflater.oncreateview(layoutinflater.java:682)         @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:741)         @ android.view.layoutinflater.inflate(layoutinflater.java:482)         @ android.view.layoutinflater.inflate(layoutinflater.java:414)         @ android.view.layoutinflater.inflate(layoutinflater.java:365)         @ com.example.swati.newsaggregator.feedlistadapter.getview(feedlistadapter.java:65)         @ android.widget.abslistview.obtainview(abslistview.java:2347)         @ android.widget.listview.measureheightofchildren(listview.java:1270)         @ android.widget.listview.onmeasure(listview.java:1182)         @ android.view.view.measure(view.java:17547)         @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:5535)         @ android.widget.linearlayout.measurechildbeforelayout(linearlayout.java:1436)         @ android.widget.linearlayout.measurevertical(linearlayout.java:722)         @ android.widget.linearlayout.onmeasure(linearlayout.java:613)         @ android.view.view.measure(view.java:17547)         @ android.support.v4.view.viewpager.onmeasure(viewpager.java:1489)         @ android.view.view.measure(view.java:17547)         @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:5535)         @ android.widget.linearlayout.measurechildbeforelayout(linearlayout.java:1436)         @ android.widget.linearlayout.measurevertical(linearlayout.java:722)         @ android.widget.linearlayout.onmeasure(linearlayout.java:613)         @ android.view.view.measure(view.java:17547)         @ android.support.v4.widget.drawerlayout.onmeasure(drawerlayout.java:940)         @ android.view.view.measure(view.java:17547)         @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:5535)         @ android.widget.framelayout.onmeasure(framelayout.java:436)         @ android.support.v7.internal.widget.contentframelayout.onmeasure(contentframelayout.java:124)         @ android.view.view.measure(view.java:17547)         @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:5535)         @ android.support.v7.internal.widget.actionbaroverlaylayout.onmeasure(actionbaroverlaylayout.java:393)         @ android.view.view.measure(view.java:17547)         @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:5535)         @ android.widget.framelayout.onmeasure(framelayout.java:436)         @ android.view.view.measure(view.java:17547)         @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:5535)         @ android.widget.linearlayout.measurechildbeforelayout(linearlayout.java:1436)         @ android.widget.linearlayout.measurevertical(linearlayout.java:722)         @ android.widget.linearlayout.onmeasure(linearlayout.java:613)         @ android.view.view.measure(view.java:17547)         @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:5535)         @ android.widget.framelayout.onmeasure(framelayout.java:436)         @ com.android.internal.policy.impl.phonewindow$decorview.onmeasure(phonewindow.java:2615)         @ android.view.view.measure(view.java:17547)         @ android.view.viewrootimpl.performmeasure(viewrootimpl.java:2015)         @ android.view.viewrootimpl.measurehierarchy(viewrootimpl.java:1173)         @ android.view.viewrootimpl.performtraversals(viewrootimpl.java:1379)         @ android.view.viewrootimpl.dotraversal(viewrootimpl.java:1061)         @ android.view.viewrootimpl$traversalrunnable.run(viewrootimpl.java:5885)         @ android.view.choreographer$callbackrecord.run(choreographer.java:767)         @ android.view.choreographer.docallbacks(choreographer.java:580)         @ android.view.choreographer.doframe(choreographer.java:550)         @ android.view.choreographer$framedisplayeventreceiver.run(choreographer.java:753)         @ android.os.handler.handlecallback(handler.java:739)         @ android.os.handler.dispatchmessage(handler.java:95)         @ android.os.looper.loop(looper.java:135)         @ android.app.activitythread.main(activitythread.java: 09-30 01:02:26.710    1233-1247/? w/activitymanager﹕ force finishing activity 1 com.example.swati.newsaggregator/.mainactivity 

this xml file cannot inflated:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/feed_bg" android:orientation="vertical" >  <linearlayout     android:layout_width="fill_parent"     android:layout_height="fill_parent"      android:layout_marginleft="@dimen/feed_item_margin"     android:layout_marginright="@dimen/feed_item_margin"     android:layout_margintop="@dimen/feed_item_margin"     android:background="@drawable/bg_parent_rounded_corner"     android:orientation="vertical"     android:paddingbottom="@dimen/feed_item_padding_top_bottom"     android:paddingtop="@dimen/feed_item_padding_top_bottom" >     <textview         android:id="@+id/txtstatusmsg"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:paddingbottom="5dp"         android:paddingleft="@dimen/feed_item_status_pad_left_right"         android:paddingright="@dimen/feed_item_status_pad_left_right"         android:paddingtop="@dimen/feed_item_status_pad_top" />      <textview         android:id="@+id/txturl"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:linksclickable="true"         android:paddingbottom="10dp"         android:paddingleft="@dimen/feed_item_status_pad_left_right"         android:paddingright="@dimen/feed_item_status_pad_left_right"         android:textcolorlink="@color/link" />      <com.example.swati.newsaggregator.feedimageview         android:id="@+id/feedimage1"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:background="@color/white"         android:scaletype="fitxy"         android:visibility="visible" /> </linearlayout> 

the code listfragment

    public class bnewsfragment extends listfragment {   private static final string arg_category = "category"; private string mcategory; private final string tag = "list_frag"; private onfragmentinteractionlistener mlistener; private feedlistadapter listadapter; private view mview; private list<feeditem> feeditems; private string url_feed = "some url";  public static bnewsfragment newinstance(string category) {     bnewsfragment fragment = new bnewsfragment();     bundle args = new bundle();     args.putstring(arg_category, category);     fragment.setarguments(args);     return fragment; }  public bnewsfragment() { }  @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      if (getarguments() != null) {         mcategory = getarguments().getstring(arg_category);     }      feeditems = new arraylist<feeditem>();     listadapter = new feedlistadapter(getcontext(), feeditems);     setlistadapter(listadapter); }  @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) {     log.d(tag,"oncreateview inflated!");     mview= inflater.inflate(r.layout.list_fragment, container, true);     cache cache = appcontroller.getinstance().getrequestqueue().getcache();     cache.entry entry = cache.get(url_feed);     if (entry != null) {         // fetch data cache         log.d(tag,"cache not empty!");         try {             string data = new string(entry.data, "utf-8");             try {                 parsejsonfeed(new jsonobject(data));             } catch (jsonexception e) {                 e.printstacktrace();             }         }         catch (unsupportedencodingexception e) {             e.printstacktrace();         }     }     else {         // making fresh volley request , getting json         log.d(tag, "making fresh volley request cache empty");         jsonobjectrequest jsonreq = new jsonobjectrequest(request.method.get,                 url_feed, null, new response.listener<jsonobject>() {              @override             public void onresponse(jsonobject response) {                 volleylog.d(tag, "initialresponse: " + response.tostring());                 if (response != null) {                     log.d(tag,"successful non-null response!");                     parsejsonfeed(response);                 }             }         }, new response.errorlistener() {              @override             public void onerrorresponse(volleyerror error) {                 volleylog.d(tag, "error: " + error.getmessage());                 log.d(tag,"request error!" + error.getmessage());             }         });         // adding request volley request queue         appcontroller.getinstance().addtorequestqueue(jsonreq);     }     return mview; }         /* @override public void onattach(activity activity) {     super.onattach(activity);     try {         mlistener = (onfragmentinteractionlistener) activity;     } catch (classcastexception e) {         throw new classcastexception(activity.tostring()                 + " must implement onfragmentinteractionlistener");     } }*/  /*@override public void ondetach() {     super.ondetach();     mlistener = null; }*/  /*@override public void onlistitemclick(listview l, view v, int position, long id) {     super.onlistitemclick(l, v, position, id);      if (null != mlistener) {         // notify active callbacks interface (the activity, if         // fragment attached one) item has been selected.         mlistener.onfragmentinteraction(dummycontent.items.get(position).id);     } }*/  private void parsejsonfeed(jsonobject response) {     try {         jsonarray feedarray = response.getjsonarray("articles");         log.d(tag,"inside parsejsonfeed");         (int = 0; < feedarray.length(); i++) {             jsonobject feedobj = (jsonobject) feedarray.get(i);             feeditem item = new feeditem();             log.d(tag, feedobj.getstring("title"));             //item.setid(feedobj.getint("id"));             //item.setname(feedobj.getstring("name"));              // image might null             //string image = feedobj.isnull("image") ? null : feedobj             //        .getstring("image");             //item.setimge(image);             item.setimge(null);             item.setstatus(feedobj.getstring("title"));             //item.setprofilepic(feedobj.getstring("profilepic"));             //item.settimestamp(feedobj.getstring("timestamp"));              // url might null             //string feedurl = feedobj.isnull("url") ? null : feedobj             //        .getstring("url");             item.seturl(null);             feeditems.add(item);         }         // notify data changes list adapater         listadapter.notifydatasetchanged();     } catch (jsonexception e) {         e.printstacktrace();     } } 

in simple listview, file inflated. added custom listfragment, error popping up. right now, have not parsed image.

since have overridden oncreateview in listfragment layout file(list_fragment.xml) should contain listview.

refer docs here: http://developer.android.com/reference/android/app/listfragment.html

sorry, posting answer because don't have 50 rep points make comment.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -