Note that there are some explanatory texts on larger screens.

plurals
  1. POclass extends ListActivity "whose id attribute is 'android.R.id.list'"
    text
    copied!<p>I'm trying to extend my main Activity to "ListActivity" (previously extends to: Activity) to use onListItemClick, but the logcat, send me "Your content must-have a ListView whose id attribute is 'android.r.id.list'". (i'm using SQLite for populate the ListView).</p> <p>mi xml is:</p> <pre><code>&lt;ListView android:id="@+id/list" // to "@id/android:list" or other styles (but nothing works) android:layout_width="fill_parent" android:layout_height="fill_parent"/&gt; // or closing with &lt;/ListView&gt; </code></pre> <p>this is the complete xml for the ListView:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt;&lt;/LinearLayout&gt; </code></pre> <p>My main class to handle the ListView:</p> <pre><code>public class lay_main extends ListActivity{ public ListView list; private DBHelper myAdap; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.lay_main); collectXML(); setupDataBase(); setupAdapter(); } private void collectXML() { list = (ListView)findViewById(R.id.list); } private void setupDataBase() { myAdap = new DBHelper(getApplicationContext(), "courses", null, 1); myAdap.insertCourses(); } private void setupAdapter() { if(myAdap.getCourses()!=null) { cAdapter adapter = new cAdapter(this, R.layout.list_courses, myAdap.getCourses()); list.setAdapter(adapter); } }} </code></pre> <p>I read <a href="https://stackoverflow.com/questions/6647831/android-your-content-must-have-a-listview-whose-id-attribute-is-android-r-id-li">Android: Your content must have a ListView whose id attribute is android.R.id.list</a>, or: <a href="https://stackoverflow.com/questions/3040374/runtime-exception-listview-whose-id-attribute-is-android-r-id-list">RuntimeException: Your content must have a ListView whose id attribute is &#39;android.R.id.list&#39;</a>, and other questions, but don't works for me, what's going on here?</p> <p>really would appreciate your help</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload