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 9105927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:13:03+00:00 2026-06-17T02:13:03+00:00

I have button that launches a ListActivity, but every time I click on it,

  • 0

I have button that launches a ListActivity, but every time I click on it, the app crashes with the following LogCat error:

01-10 13:12:51.327: E/AndroidRuntime(2970): FATAL EXCEPTION: main
01-10 13:12:51.327: E/AndroidRuntime(2970): java.lang.RuntimeException: Unable to start     activity ComponentInfo{com.app/com.app.Settings}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'

This is the xml code:

<?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:background="@color/background"
android:orientation="vertical"
android:padding="15dip" >

<ListView
    android:id="@+id/listViewSettings"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
</ListView>

</LinearLayout>

And this is the Java code:

import java.util.ArrayList;

import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;

public class Settings extends ListActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.settings);
        ArrayList<String> listItems=new ArrayList<String>();
        listItems.add("foo");
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1,
                listItems);
            setListAdapter(adapter);
    }

}

I have already tried changing the list id to list but if I do this I get the following error:

If I do this I get the following error: `Error: No resource found that matches the given name (at 'id' with value '@id/list').`
  • 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-17T02:13:04+00:00Added an answer on June 17, 2026 at 2:13 am

    ListActivity does not require that you assign a layout to it via the setContentView() method, if you only want to show a ListView ListActivity contains by default a ListView.

    In case you need to include more Views than a ListView in your ListActivity you can still assign a layout to your Activity. In this case your layout must contain a ListView with the android:id attribute set to @android:id/list.

    So change your list id to:

    android:id="@android:id/list"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a button that launches the google maps app on my device via
If I have a button action that launches an AsyncTask. What if I click
I have a button in my app that launches another app (the user can
I have a count down that launches after you click the button. What I'd
I have event Button that creates text box in run time. Private Sub Button1_Click(ByVal
Within a form I have a button that launches a cfwindow, then presents a
I have a delete and update button that launches a popup. In the popup
I have created a simple webpage that launches a widget after a button is
I have one simple widget consisting in a simple button that launches the main
I have an asp.net app that launches a modal window upon button_click event. That

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.