your content must have a listview whose id attribute is 'android.r.id.list' -
your content must have a listview whose id attribute is 'android.r.id.list' -
this question has reply here:
your content must have listview id attribute 'android.r.id.list' 9 answersi have searched forum similar issue , far can tell doing way other solutions suggest, still error "your content must have listview id attribute android.r.id.list"
my mainactivity.java looks like:
public class mainactivity extends listactivity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      if (savedinstancestate == null) {         getfragmentmanager().begintransaction()           .add(r.id.container, new placeholderfragment()).commit();     }      setlistadapter(new arrayadapter<string>(this,         android.r.layout.simple_list_item_1,         new arraylist<string>()));   }    my activity_main.xml:
<framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="dk.beatpro.mibfinder.mainactivity" tools:ignore="mergerootframe" />    and fragment_mail.xml:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:paddingbottom="@dimen/activity_vertical_margin"     android:paddingleft="@dimen/activity_horizontal_margin"     android:paddingright="@dimen/activity_horizontal_margin"     android:paddingtop="@dimen/activity_vertical_margin"     tools:context="dk.beatpro.mibfinder.mainactivity$placeholderfragment" >      <button          android:id="@+id/button_findmib"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/button_findmib" />      <listview         android:id="@android:id/list"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@id/button_findmib" />  </relativelayout>    but next runtime error:
06-24 09:00:07.726: e/androidruntime(10542): fatal exception: main 06-24 09:00:07.726: e/androidruntime(10542): process: dk.beatpro.mibfinder, pid: 10542 06-24 09:00:07.726: e/androidruntime(10542): java.lang.runtimeexception: unable start activity componentinfo{dk.beatpro.mibfinder/dk.beatpro.mibfinder.mainactivity}: java.lang.runtimeexception: content must have listview id attribute 'android.r.id.list'    even though have android:id="@android:id/list" <listview\> element.
can tell me i'm missing here?
your listview id = "@android:id/list" must part of activity, not fragment. in code list view part of fragment. can utilize mutual activity instead of listactivity , listfragment (as parent of placeholderfragment class). or can move list fragment activity.
 android listview android-listview runtime-error 
 
Comments
Post a Comment