RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' 라는 에러가 나오는데 어떻게해야하나요

조회수 1679회

아래와 같은 메세지로 런타임 에러가 발생했는데 전 제가 뭘 잘못한건지 모르겠어요.

java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.newslist);
    mDbHelper.open();
    fillData();
}

private void fillData() {
    Bundle extras = getIntent().getExtras();
    long catID = extras.getLong("cat_id");
    Cursor c = mDbHelper.fetchNews(catID);
    startManagingCursor(c);

    String[] from = new String[] { DBHelper.KEY_TITLE };
    int[] to = new int[] { R.id.newslist_text };

    SimpleCursorAdapter notes = new SimpleCursorAdapter(this, R.layout.text_newslist, c, from, to);
    setListAdapter(notes);
}

newslist.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content">
    <ListView 
         android:id="@+id/catnewslist"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content">
    </ListView>
</LinearLayout>

text_newslist.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <TextView 
        android:text="@+id/newslist_text"
        android:id="@+id/newslist_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">    
    </TextView>
</LinearLayout>

제가 뭘 잘못한거죠?

1 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)