-5

i get this error : "unfortunetly your app must stop"

and the Logcat is,please someone can tell me where is the problem?

09-04 13:29:56.840: E/AndroidRuntime(574): FATAL EXCEPTION: main
09-04 13:29:56.840: E/AndroidRuntime(574): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fast/com.example.fast.MainActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
09-04 13:29:56.840: E/AndroidRuntime(574):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
09-04 13:29:56.840: E/AndroidRuntime(574):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
09-04 13:29:56.840: E/AndroidRuntime(574):  at android.app.ActivityThread.access$600(ActivityThread.java:123)
09-04 13:29:56.840: E/AndroidRuntime(574):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
09-04 13:29:56.840: E/AndroidRuntime(574):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-04 13:29:56.840: E/AndroidRuntime(574):  at android.os.Looper.loop(Looper.java:137)
09-04 13:29:56.840: E/AndroidRuntime(574):  at android.app.ActivityThread.main(ActivityThread.java:4424)
09-04 13:29:56.840: E/AndroidRuntime(574):  at java.lang.reflect.Method.invokeNative(Native Method)
09-04 13:29:56.840: E/AndroidRuntime(574):  at java.lang.reflect.Method.invoke(Method.java:511)
09-04 13:29:56.840: E/AndroidRuntime(574):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-04 13:29:56.840: E/AndroidRuntime(574):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-04 13:29:56.840: E/AndroidRuntime(574):  at dalvik.system.NativeStart.main(Native Method)
09-04 13:29:56.840: E/AndroidRuntime(574): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
09-04 13:29:56.840: E/AndroidRuntime(574):  at android.app.ListActivity.onContentChanged(ListActivity.java:243)
09-04 13:29:56.840: E/AndroidRuntime(574):  at android.preference.PreferenceActivity.onContentChanged(PreferenceActivity.java:944)
09-04 13:29:56.840: E/AndroidRuntime(574):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:254)
09-04 13:29:56.840: E/AndroidRuntime(574):  at android.app.Activity.setContentView(Activity.java:1835)
09-04 13:29:56.840: E/AndroidRuntime(574):  at com.example.fast.MainActivity.onCreate(MainActivity.java:50)
09-04 13:29:56.840: E/AndroidRuntime(574):  at android.app.Activity.performCreate(Activity.java:4465)
09-04 13:29:56.840: E/AndroidRuntime(574):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
09-04 13:29:56.840: E/AndroidRuntime(574):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
09-04 13:29:56.840: E/AndroidRuntime(574):  ... 11 more

i dont entend ListActivity!

i have only:

3 jave files:

"public class MainActivity extends PreferenceActivity  implements OnClickListener"

"public class QuickPrefsActivity  extends PreferenceActivity"

"public class ShowSettingsActivity extends Activity"

so i dont undertand where the problem comes from?

fsdf fsd
  • 1,301
  • 4
  • 13
  • 13
  • 1
    if you are extending list activity your list views id must be android.R.id.list – Athul Harikumar Sep 04 '12 at 13:34
  • it will be good to check out Preference Activity tutorial http://androidresearch.wordpress.com/2012/03/09/creating-a-preference-activity-in-android/ – rajpara Sep 04 '12 at 13:55
  • @rajpara, thanks for this guide, i read it, and in the mainactivity what should i type for start the preferences activity? – fsdf fsd Sep 04 '12 at 14:17

1 Answers1

1

Please see

RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'

<ListView android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>

This will solve the error if you still want to use a ListActivity.

Community
  • 1
  • 1
DroidRam
  • 38
  • 1
  • 6