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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:13:03+00:00 2026-05-30T20:13:03+00:00

Below is some code that I copied and edited. If I make the ColorsActivity

  • 0

Below is some code that I copied and edited. If I make the ColorsActivity extend activity, everything works fine. But if it extends ListActivity, it gives me the error, “Your content must have a listview who’s ID attribute is android.R.Id.List”.

Can someone please explain this to me?

public class ColorsActivity extends Activity {
/** Called when the activity is first created. */
//ListView that will hold our items references back to main.xml
ListView lstTest;
//Array Adapter that will hold our ArrayList and display the items on the ListView
SeekBarAdaptor seekBarAdaptor;

//List that will  host our items and allow us to modify that array adapter
ArrayList<SeekBar> seekBarArrayList=null;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.seekbarlist);
    //Initialize ListView
    lstTest= (ListView)findViewById(R.id.myList);

     //Initialize our ArrayList
    seekBarArrayList = new ArrayList<SeekBar>();
    //Initialize our array adapter notice how it references the listitems.xml layout
    seekBarAdaptor = new SeekBarAdaptor(ColorsActivity.this, R.layout.seekbars,seekBarArrayList);
    SeekBar red = new SeekBar(ColorsActivity.this);
    SeekBar blue = new SeekBar(ColorsActivity.this);
    //Set the above adapter as the adapter of choice for our list
    lstTest.setAdapter(seekBarAdaptor);
    seekBarArrayList.add(red);
    seekBarArrayList.add(blue);
    //Instantiate the Web Service Class with he URL of the web service not that you must pass
    //WebService webService = new WebService("http://www.sumasoftware.com/alerts/GetAlerts.php");

    //Pass the parameters if needed , if not then pass dummy one as follows
    Map<String, String> params = new HashMap<String, String>();
    params.put("var", "");

    //Get JSON response from server the "" are where the method name would normally go if needed example
    // webService.webGet("getMoreAllerts", params);
    //String response = webService.webGet("", params);

    /*try
    {
        //Parse Response into our object
        Type collectionType = new TypeToken<ArrayList<alerts>>(){}.getType();

        //JSON expects an list so can't use our ArrayList from the lstart
        List<alerts> lst= new Gson().fromJson(response, collectionType);

        //Now that we have that list lets add it to the ArrayList which will hold our items.
        for(alerts l : lst)
        {
            alrts.add(l);
        }

        //Since we've modified the arrayList we now need to notify the adapter that
        //its data has changed so that it updates the UI
        arrayAdapter.notifyDataSetChanged();
    }
    catch(Exception e)
    {
        Log.d("Error: ", e.getMessage());
    }*/
}

}

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>

<ListView
    android:id="@+id/myList"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
</ListView>

</LinearLayout>
  • 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-05-30T20:13:04+00:00Added an answer on May 30, 2026 at 8:13 pm

    use this

     <ListView
            android:id="@android:id/list"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="1" >
        </ListView>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is some code I've written that is effective, but makes too many database
See code below, for some reason it only works when I put a breakpoint
Let us say we have some code that looks like below: @interface SomeClass :
I wrote some code (about 100 lines) that is working fine on version 5.12.1.
The code below works on one page, but not another page (the place it
Below is some code that I'm using to create objects with Visual Basic: For
below is some code I am using to translate a map array into SQL
When I use a conditional statement targeting IE6 and below with some PHP code
// .net 2.0 and vs2005 used. I find some code below. I am not
Below I present you some code which has completely been butchered by me. $(.gig).hover(function()

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.