android - XML layout has a ListView - But still getting ListView id not found exception -
i see lot of questions being asked in stackoverflow on same topic, could not understand deep problem
of exception.
below xml layout. have listview.
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="#ffffff"> <listview android:id="@+id/list" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#656565" android:paddingleft="@dimen/list_padding" android:paddingright="@dimen/list_padding" android:dividerheight="20.0sp" android:divider="#656565"/> </linearlayout>
below fragment class.
public class fragmentclass extends sherlocklistfragment implements asynclistner{ @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { return inflater.inflate(r.layout.documents, container, false); } @override public void onactivitycreated(bundle savedinstancestate){ } @override public void onloadcomplete(list<documentresponse> data) { documentsadapter adapter = new documentsadapter(getsherlockactivity(), r.id.list, data); setlistadapter(adapter); } }
once onloadcomplete call finished, trying create listview. error. "your content must have listview id attribute android.r.id.list"
change android:id="@+id/list"
android:id="@android:id/list"
with using requested android.r.id.list
id.
don't forget update code, too
documentsadapter adapter = new documentsadapter(getsherlockactivity(), android.r.id.list, data);
Comments
Post a Comment