following is my logcat output
10-16 14:00:32.008: ERROR/AndroidRuntime(1123): Uncaught handler:
thread main exiting due to uncaught exception
10-16 14:00:32.048: ERROR/AndroidRuntime(1123):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.monarch.home/com.monarch.home.AddRoom}:
java.lang.RuntimeException: Your content must have a ListView whose id
attribute is 'android.R.id.list'
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2496)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2512)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
android.app.ActivityThread.access$2200(ActivityThread.java:119)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
android.os.Handler.dispatchMessage(Handler.java:99)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
android.os.Looper.loop(Looper.java:123)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
android.app.ActivityThread.main(ActivityThread.java:4363)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
java.lang.reflect.Method.invokeNative(Native Method)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
java.lang.reflect.Method.invoke(Method.java:521)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
dalvik.system.NativeStart.main(Native Method)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): Caused by:
java.lang.RuntimeException: Your content must have a ListView whose id
attribute is 'android.R.id.list'
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
android.app.ListActivity.onContentChanged(ListActivity.java:236)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:
201)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
android.app.Activity.setContentView(Activity.java:1622)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
com.monarch.home.AddRoom.onCreate(AddRoom.java:19)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2459)
10-16 14:00:32.048: ERROR/AndroidRuntime(1123): ... 11 more
On Oct 16, 1:36 pm, "pramod.deore" <[email protected]> wrote:
> I am getting this error- Your content must have a ListView whose id
> attribute is 'android.R.id.list'
> my xml file is
>
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent"
> android:orientation="vertical"
> >
>
> <ListView android:id="@+id/list"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> />
> <TextView
> android:id="@+id/footer"
> android:layout_width="fill_parent"
> android:layout_height="60dip"
> android:text="@string/footer"
> android:padding="4dip"
> android:background="#FF666666"
> />
> </LinearLayout>
>
> and .java fiile is like
>
> public void onCreate(Bundle savedInstanceState)
> {
> System.out.println ("First stmt in onCreate of AddRoom");
> super.onCreate(savedInstanceState);
> setContentView(R.layout.addroom);
>
> String[] rooms =
> getResources().getStringArray(R.array.Room_array);
> // By using setAdpater method in listview we an add string
> array in
> list.
> ListView list = (ListView)findViewById(R.id.list);
> ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
> R.layout.listitem, rooms);
> list.setAdapter(adapter);
> registerForContextMenu(list);
>
> }
>
> and error is at line 19 which is- setContentView(R.layout.addroom);
> what is wrong?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en