Reputation: 8468
I am trying to use List View and List activity. My code is very simple, here are my java and xml files. The MyRecords.java file is:
public class MyRecords extends ListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.myrecords);
.
.
.
myrecords.xml file is:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:id="@+id/myrecords">
</TextView>
and I have added this to the Manifest file:
<activity android:name=".MyRecords"
android:label="@string/myrecords_title" >
</activity>
in my main activity page I have a button corresponding to MyRecords. The problem is that as soon as I press the button the application force closes. I appreciate any help in letting me know what is wrong with this code. I must mention that when instead of ListActivity, I had activity, there was no problem with the code.
Thanks for the help.
TJ1
Upvotes: 0
Views: 141
Reputation: 2414
A ListActivity needs to be supplied a layout that contains a ListView with the correct id (I think it's android:id/list).
Upvotes: 2