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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:33:02+00:00 2026-05-16T23:33:02+00:00

I have created a list view within a tab with a list of teams

  • 0

I have created a list view within a tab with a list of teams within it. I want to create a activity which when clicked goes to another class, I want to do this with 20 items that will be in this list. My code so far is:

public class ll2 extends ListActivity {

    static final String[] teams = new String[]{"Accrington Stanley",
            "Aldershot", "Barnet", "Bradford City", "Burton Albion",
            "Bury", "Cheltenham Town", "Chesterfield", "Crewe Alexandra"};

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

        final String[] TEAMS = getResources().getStringArray(R.array.twoteams_array);
        setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, TEAMS));


        ListView lv = getListView();
        lv.setTextFilterEnabled(true);

        lv.setOnItemClickListener(new OnItemClickListener() {
            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();


                Intent intent;

                intent = new Intent().setClass(this, Bradford.class);


            }
        });
    }

}

I have read some tutorials, but they do not mention how to maka a clickable listview.

How can I achieve this?

  • 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-16T23:33:03+00:00Added an answer on May 16, 2026 at 11:33 pm

    You’ll probably want to override the onListItemClick method in your ListActivity. Based on the position, you will construct an appropriate intent.

    @Override
    public void onListItemClick(ListView parent, View v, int position, long id) {
        if (position == appropriate_condition) {
            Intent intent = new Intent(this, Bradford.class);
            startActivity(intent);
        }
    }
    

    If you need to access data associated with the item, the documentation provides this suggestion:

    Subclasses can call getListView().getItemAtPosition(position) if they need to access the data associated with the selected item.

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

Sidebar

Related Questions

I need to display a list of comments within a view. I have created
I have created a list view that displays the names and dates of items
I have created a custom list view, each row has it's own custom selector,
I have created navigaton view using Sencha touch 2. Navigation view has list component
I have created a TableView(Grouped Table View). And I can list the items in
OK, so I have learned how to create a list, view items in the
I have a List of objects that contain another List . I want to
I have an Android app with a main tab activity, and several activities within
I am trying to display ListView . I have created one activity , in
I'm using ASP.NET MVC and I have a model class which represents a peice

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.