I'm going to write a list view Compilation works well
Your content must have a ListView whose id attribute is 'android.R.id.list'
If you get this kind of error, it will explode if you execute it.
My source is
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.8"></ListView>
m_Adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_multiple_choice, new_name); listView = (ListView) findViewById(R.id.list);
What's the problem?
I think the current activity is ListActivity. In case of ListActivity, The id of the list view should be as below.
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.8"></ListView>
You have to register it like this.
And
listView = (ListView) findViewById(android.R.id.list);
You have to fix this part like this, too.
© 2024 OneMinuteCode. All rights reserved.