Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8053933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:00:46+00:00 2026-06-05T08:00:46+00:00

I have been using Google’s tutorial for writing a ListView, and for some reason

  • 0

I have been using Google’s tutorial for writing a ListView, and for some reason an error keeps occurring. I have already made sure to create the external storage permission like I saw in a different post, but still something is happening.

Main Activity:

public class FlashcardsActivity extends ListActivity {
private ListView mainList;
private final String[] listOptions = {"Test!","New Set", "Edit Existing"};
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
setListAdapter(new ArrayAdapter<String>(this, R.layout.list_row,listOptions));

mainList=(ListView)findViewById(R.id.mainList);
mainList.setTextFilterEnabled(true);

mainList.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        Toast.makeText(getApplicationContext(), ((TextView)view).getText(),Toast.LENGTH_SHORT).show();
    }
});
}
}

LogCat:

06-09 21:29:32.239: D/AndroidRuntime(221): Shutting down VM
06-09 21:29:32.239: W/dalvikvm(221): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
06-09 21:29:32.250: E/AndroidRuntime(221): Uncaught handler: thread main exiting due to uncaught exception
06-09 21:29:32.259: E/AndroidRuntime(221): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aft.flashcards/com.aft.flashcards.FlashcardsActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
06-09 21:29:32.259: E/AndroidRuntime(221):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
06-09 21:29:32.259: E/AndroidRuntime(221):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
06-09 21:29:32.259: E/AndroidRuntime(221):  at android.app.ActivityThread.access$2200(ActivityThread.java:119)
06-09 21:29:32.259: E/AndroidRuntime(221):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
06-09 21:29:32.259: E/AndroidRuntime(221):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-09 21:29:32.259: E/AndroidRuntime(221):  at android.os.Looper.loop(Looper.java:123)
06-09 21:29:32.259: E/AndroidRuntime(221):  at android.app.ActivityThread.main(ActivityThread.java:4363)
06-09 21:29:32.259: E/AndroidRuntime(221):  at java.lang.reflect.Method.invokeNative(Native Method)
06-09 21:29:32.259: E/AndroidRuntime(221):  at java.lang.reflect.Method.invoke(Method.java:521)
06-09 21:29:32.259: E/AndroidRuntime(221):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
06-09 21:29:32.259: E/AndroidRuntime(221):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
06-09 21:29:32.259: E/AndroidRuntime(221):  at dalvik.system.NativeStart.main(Native Method)
06-09 21:29:32.259: E/AndroidRuntime(221): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
06-09 21:29:32.259: E/AndroidRuntime(221):  at android.app.ListActivity.onContentChanged(ListActivity.java:236)
06-09 21:29:32.259: E/AndroidRuntime(221):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
06-09 21:29:32.259: E/AndroidRuntime(221):  at android.app.Activity.setContentView(Activity.java:1622)
06-09 21:29:32.259: E/AndroidRuntime(221):  at com.aft.flashcards.FlashcardsActivity.onCreate(FlashcardsActivity.java:19)
06-09 21:29:32.259: E/AndroidRuntime(221):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-09 21:29:32.259: E/AndroidRuntime(221):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
06-09 21:29:32.259: E/AndroidRuntime(221):  ... 11 more
06-09 21:29:32.290: I/dalvikvm(221): threadid=7: reacting to signal 3
06-09 21:29:32.290: E/dalvikvm(221): Unable to open stack trace file '/data/anr/traces.txt': Permission denied

Main.xml

<?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="wrap_content"
    android:layout_height="fill_parent"/>

</LinearLayout>

Does anyone know what the issue is?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T08:00:47+00:00Added an answer on June 5, 2026 at 8:00 am

    The error log is quite clear:

    06-09 21:29:32.259: E/AndroidRuntime(221): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is ‘android.R.id.list’

    You need a ListView with android:id="@android:id/list" in your main layout.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some good experience with Google Analytics and have been using it for
We have been using Google Code SVN to store a school project. As we
I have been searching around using Google but I can't find an answer to
I have been using Dojo hosted on Google's CDN. I just downloaded the development
I have been using Entity Framework CTP with Code-First as in this tutorial by
I have been using Google Chrome's dev tool kit (element inspection, stack trace, javascript
I have been using Google app engine for ~2 years now and love it.
So I've been using the google calendar API (objective C) and have been able
I have been using Java for a long time, and for quite some time
I have been using the ncommon framework ( http://code.google.com/p/ncommon/ ) with nhibernate and asp.net

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.