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

  • Home
  • SEARCH
  • 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 3222600
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:00:35+00:00 2026-05-17T16:00:35+00:00

My apologies in advance if this is a repeat question, I looked all over

  • 0

My apologies in advance if this is a repeat question, I looked all over and couldn’t find any solution to help me.

I have followed the android dev tutorial for creating a tabbed UI that uses a separate activity for each tab.

And I got it working just fine. Until…

I am attempting to put a ListView inside one of the tabbed activities (Tab1). To get the usability I want, I find that I need to extend ListActivity. Thats when I get the ‘Force close’ error. It displays just fine when I extend regular Activity.

Here is my nonfunctional Tab1.java code:

public class Tab1 extends ListActivity {
    ListView lv;
    String[] times = {
        "7:00 AM", "8:00 AM", "9:00 AM", "10:00 AM", "11:00 AM",
            "12:00 AM", "1:00 PM", "2:00 PM", "3:00 PM", "4:00 PM",
            "5:00 PM", "6:00 PM", "7:00 PM"
    };

    /** Called when the activity is first created. */@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tab1);

        lv = (ListView) findViewById(R.id.ListView_Tab1);
        lv.setAdapter(new ArrayAdapter < String > (this, R.layout.list_item, R.id.times,
            times));
        lv.setOnItemClickListener(new OnItemClickListener() {@
            Override
            public void onItemClick(AdapterView <? > parent, View view,
                int position, long id) {
                // When clicked, show a toast with the TextView text
                Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
                    Toast.LENGTH_SHORT).show();
            }
        });
    }
}
  • 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-17T16:00:36+00:00Added an answer on May 17, 2026 at 4:00 pm

    the ID of your ListView must be @android:id/list when using a ListActivity

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

Sidebar

Related Questions

(Apologies in advance if this is answered elsewhere. I looked around and couldn't find
All, Apologies in advance - this question might be too open-ended for SO. Anyway...
Apologies in advance if this question is badly worded! I have a MySQL table
Apologies in advance for the length of this question! I have a data structure
Apologies in advance if this becomes a very long question... Background Info I have
Apologies in advance, because I suspect this may be a silly question. I have
This may be a bit of an abstract question, so apologies in advance. I
This, I'm sure is a pretty basic question about JavaScript, so apologies in advance.
Apologies in advance if this is a silly question, am very much a beginner.
Apologies in advance but I have never seen this error before and don't know

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.