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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:15:34+00:00 2026-05-23T15:15:34+00:00

I’m getting this run-time error and I’m really struggling to get to the bottom

  • 0

I’m getting this run-time error and I’m really struggling to get to the bottom of it: “Your content must have a ListView whose id attribute is android.R.id.list”.

Here is my code:

public class ShowAllJobsInArea extends ListActivity{

    Context context;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.show_jobs_in_area);
        context=getApplicationContext();

        String area=Cookie.getAreaSelected();

        final ProgressBar thinger=(ProgressBar) findViewById(R.id.progressBar2);
        TabHost tabHost=(TabHost)findViewById(android.R.id.tabhost);
        tabHost.setup();

        TabSpec spec1=tabHost.newTabSpec("Tab 1");
        spec1.setContent(R.id.tab1);
        spec1.setIndicator("Starting");

        TabSpec spec2=tabHost.newTabSpec("Tab 2");
        spec2.setContent(R.id.tab2);
        spec2.setIndicator("# Days");        

        TabSpec spec3=tabHost.newTabSpec("Tab 3");
        spec3.setContent(R.id.tab3);
        spec3.setIndicator("Rate");


        tabHost.addTab(spec1);
        tabHost.addTab(spec2);
        tabHost.addTab(spec3);

        Handler handler = new Handler() {
             public void handleMessage(Message message) {
                  switch (message.what) {
                      case HttpConnection.DID_START:
                          thinger.setVisibility(View.VISIBLE);
                          break;
                      case HttpConnection.DID_SUCCEED:
                          String response = (String) message.obj;
                          Log.i("EOH",response);

                          ArrayList<String> startDates=new ArrayList<String>();
                          ArrayList<String> ns=new ArrayList<String>();
                          ArrayList<String> rates=new ArrayList<String>();
                          HashMap<String, JSONObject> countyObjs=new HashMap<String, JSONObject>();

                          JSONObject object = null;
                          try {
                              object = (JSONObject) new JSONTokener(response).nextValue();

                              for(int i=0;i<object.length();i++){
                                  String area="";
                                  String endDate="";
                                  String endTimes="";
                                  String id="";
                                  String startDate="";
                                  String startTimes="";
                                  String rate="";
                                  String alreadyApplied="";
                                  String n="";
                                  JSONObject countyObj=object.getJSONObject(String.valueOf(i));
                                  countyObjs.put(id, countyObj);

                                  area=countyObj.getString("area");
                                  endDate=countyObj.getString("endDate");
                                  endTimes=countyObj.getString("endTimes");
                                  id=countyObj.getString("id");
                                  startDate=countyObj.getString("startDate");
                                  startTimes=countyObj.getString("startTimes");
                                  rate=(countyObj.getString("rates").split(","))[0];
                                  alreadyApplied=countyObj.getString("alreadyApplied");
                                  n=countyObj.getString("n");

                                  startDates.add(startDate+","+id);
                                  ns.add(n+","+id);
                                  rates.add(rate+","+id);
                              }
                          }catch (JSONException e) {
                              e.printStackTrace();
                          }

                          Collections.sort(startDates);
                          Collections.sort(ns);
                          Collections.sort(rates);                    

                          String[] startDates_str = new String[startDates.size()];
                          startDates.toArray(startDates_str);

                          setListAdapter(new ArrayAdapter<String>(getApplicationContext(), R.layout.list_item, startDates_str));
                          //setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, COUNTRIES));
                          ListView lv = getListView();
                          lv.setTextFilterEnabled(true);



                          thinger.setVisibility(View.INVISIBLE);

                          break;
                      case HttpConnection.DID_ERROR:
                          thinger.setVisibility(View.INVISIBLE);
                          break;
                      default:
                          break;
                  }
             }
        };

        List<NameValuePair> params = new ArrayList<NameValuePair>(1);
        params.add(new BasicNameValuePair("area", area)); 
        new HttpConnection(handler).post("http://www.xlhi.com/ajax/getJobsInArea.php",params);
    }
}

show_jobs_in_area.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent">
    <TabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent">
        <LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
            <TabWidget android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@android:id/tabs"></TabWidget>
            <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@android:id/tabcontent">
                <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab1" android:orientation="vertical">
                    <ProgressBar android:id="@+id/progressBar2" android:layout_height="wrap_content" style="?android:attr/progressBarStyleLarge" android:layout_width="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="25dip"></ProgressBar>
                    <ListView android:id="@+id/listView1" android:layout_height="wrap_content" android:layout_width="match_parent"></ListView>
                </LinearLayout>
                <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab2"></LinearLayout>
                    <ListView android:id="@+id/listView2" android:layout_height="wrap_content" android:layout_width="match_parent">
                </ListView>
                <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab3">
                    <ListView android:id="@+id/listView3" android:layout_height="wrap_content" android:layout_width="match_parent"></ListView>
                </LinearLayout>
            </FrameLayout>
        </LinearLayout>
    </TabHost>
</LinearLayout>

list_item.xml:

<?xml version="1.0" encoding="utf-8"?>
<TextView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="10dp"
    android:textSize="16sp" >
</TextView>

I’ve tried changing the id to android.id=”@android:id/list” to no avail – still getting the same error. I was thinking it’s something to do with the asynchronous request I’m doing… I’m really stuck now and hope someone can help.

Many thanks in advance,

  • 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-23T15:15:34+00:00Added an answer on May 23, 2026 at 3:15 pm

    If you have more than one ListView in your layout you should not extend ListActivity but rather extend Activity and handle the ListViews yourself like;

    ListView list1 = (ListView) findViewById(R.id.myList1);
    list1.setAdapter(...);
    
    ListView list2 = (ListView) findViewById(R.id.myList2);
    list2.setAdapter(...);
    

    ListActivity is a shorthand helper class that makes life easier when you are working with only one ListView in your layout.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't

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.