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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:37:48+00:00 2026-05-29T07:37:48+00:00

I am trying to write a parser that parses out HTML times for bus

  • 0

I am trying to write a parser that parses out HTML times for bus routes.
But im having a problem getting the list to show up with a while loop.
I if use

Content = extractor.BusRoutes.get(0);
Content = extractor.BusRoutes.get(1);

I can get them to show up in a list by using a text view in android, but I want a list.

I can get a list if i go

setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, busroutearray));

But thats if i have an XML already populated with the items, which i cant use easily.

the loop i am doing now is

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);



    ArrayList<String> busroutearray = new ArrayList<String>();

    int x = 0;
    while(x > 37){
        busroutearray.add(x, extractor.BusRoutes.get(x));
    x++;
    }

setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, busroutearray));

I can not figure out why it wont display, is there a better way to do this? the “x” is the spot in the array from 0 to 37.

Here is the LogCat

02-08 16:45:27.222: D/dalvikvm(1882): GC_EXTERNAL_ALLOC freed 52K, 54% free 2487K/5379K, external 1596K/2108K, paused 46ms
02-08 16:45:32.320: D/AndroidRuntime(1882): Shutting down VM
02-08 16:45:32.320: W/dalvikvm(1882): threadid=1: thread exiting with uncaught exception (group=0x40015578)
02-08 16:45:32.324: E/AndroidRuntime(1882): FATAL EXCEPTION: main
02-08 16:45:32.324: E/AndroidRuntime(1882): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.taylordev.nextstop/com.taylordev.nextstop.BusRoutes}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
02-08 16:45:32.324: E/AndroidRuntime(1882):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at android.os.Looper.loop(Looper.java:123)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at android.app.ActivityThread.main(ActivityThread.java:3687)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at java.lang.reflect.Method.invokeNative(Native Method)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at java.lang.reflect.Method.invoke(Method.java:507)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at dalvik.system.NativeStart.main(Native Method)
02-08 16:45:32.324: E/AndroidRuntime(1882): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
02-08 16:45:32.324: E/AndroidRuntime(1882):     at android.app.ListActivity.onContentChanged(ListActivity.java:243)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:212)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at android.app.Activity.setContentView(Activity.java:1657)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at com.taylordev.nextstop.BusRoutes.onCreate(BusRoutes.java:50)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-08 16:45:32.324: E/AndroidRuntime(1882):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
02-08 16:45:32.324: E/AndroidRuntime(1882):     ... 11 more
  • 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-29T07:37:49+00:00Added an answer on May 29, 2026 at 7:37 am
    int x = 0;
        while(x > 37){
            busroutearray.add(x, extractor.BusRoutes.get(x));
        x++;
        }
    

    You never enter in your loop because you have x=0 and then the set the condition in the while loop to x > 37 (which is false). Maybe you’ll want to try x < 37 to actually get in your loop.

    EDIT:
    For that exception, your activity BusRoutes probably extends ListActivity and you set a different layout with setContentView(), a layout that doesn’t have the proper ListView element. If you extend ListActivity and set a different layout whith the method setContentView(), in that layout, you must have a ListView element with the id :

    android:id="@android:id/list"
    

    so that the android system can know which ListView element to bind to the ListActivity. If this doesn’t solve the exception please post the code for the BusRoutes, at least the onCreate() method.

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

Sidebar

Related Questions

I'm trying to write a parser that uses two characters as token boundaries, but
I'm trying to write a regex that will parse out the directory and filename
I'm trying to write a SAX parser for an XHTML document that I download
I need to write a script that takes a link and parses the HTML
I know that there are many ASN.1 parser out there but they cost quite
I'm trying to write an SAX XML Parser in Java and I keep getting
I am trying to write a generic Parse method that converts and returns a
I'm trying to write a Perl script that will parse the output of the
I'm trying to write a small parser with Irony . Unfortunately I get a
I'm trying to write a generic XML to Core Data parser using libxml2. Since

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.