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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:40:13+00:00 2026-06-14T00:40:13+00:00

I want to make all my list items in the listview open up into

  • 0

I want to make all my list items in the listview open up into a new page, so each listview item opens up onto a new black page that I can use. I don’t know how to implement this at all. I have searched for hours on end and can’t find an answer to my solution. It would be much appreciated if someone could show and/or explain how to do this instead of providing a link, but either is helpful.

Here is my code so far:

  <string-array name="sections">
    <item >Pro Constructive</item>
    <item >Con Constructive</item>
    <item >1st Speaker Cross</item>
    <item >Pro Rebbutal</item>
    <item >Con Rebuttal</item>
    <item >2nd Speaker Cross</item>
    <item >Pro Summary</item>
    <item >Con Summary</item>
    <item >Grand Cross</item>
    <item >Pro Final Focus</item>
    <item >Con Final Focus</item>
</string-array>

This is in my string.xml

    <ListView
    android:id="@+id/listView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:entries="@array/sections" >
</ListView>

This is in my activity_main.xml.

Where do I go from here to make each item in my list clickable and able to open up onto a new page?

Thanks in advance!

EDIT:

Logcat no longer relevant.

  • 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-06-14T00:40:15+00:00Added an answer on June 14, 2026 at 12:40 am

    In fact it is quite easy:

    This is your Activity with the ListView, it implements an OnItemClickListener:

    public class MainActivity extends Activity implements OnItemClickListener {
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            setContentView(R.layout.activity_main);
    
            //* *EDIT* * 
            ListView listview = (ListView) findViewById(R.id.listView1);
            listview.setOnItemClickListener(this);
        }
    
        public void onItemClick(AdapterView<?> l, View v, int position, long id) {
            Log.i("HelloListView", "You clicked Item: " + id + " at position:" + position);
                // Then you start a new Activity via Intent
                Intent intent = new Intent();
                intent.setClass(this, ListItemDetail.class);
                intent.putExtra("position", position);
                // Or / And
                intent.putExtra("id", id);
                startActivity(intent);
        }
    

    Edit

    The above code would be placed in your MainActivity.java. I changed the name of the class to MainActivity and the contentView to setContentView(R.layout.activity_main) – The names are those of a freshly created Android Project in Eclipse.
    Please see also the 2 new lines under //* Edit * – those will set the Listener for clicks on items in the list.

    Your activity_main.xml should look like this:

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
    
        <ListView
            android:id="@+id/listView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:entries="@array/sections" >
        </ListView>
    </RelativeLayout>
    

    The array.xml (not string.xml) in your `res/values/` folder looks like this

    <resources>
        <string-array name="sections">
            <item >Pro Constructive</item>
            <item >Con Constructive</item>
            <item >1st Speaker Cross</item>
            <item >Pro Rebbutal</item>
            <item >Con Rebuttal</item>
            <item >2nd Speaker Cross</item>
            <item >Pro Summary</item>
            <item >Con Summary</item>
            <item >Grand Cross</item>
            <item >Pro Final Focus</item>
            <item >Con Final Focus</item>
        </string-array>
    </resources>
    

    N.B.: If you copy & paste this code it should work. But you will get an error by clicking on an Item because you haven’t created the ListItemDetail.class yet.

    Here is an example of how this could look:

    Your ListItemDetail.java:

    public class ListItemDetail extends Activity {
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_listitem);
    
        Intent intent = getIntent();
        int position = intent.getIntExtra("position", 0);
    
        // Here we turn your string.xml in an array
        String[] myKeys = getResources().getStringArray(R.array.sections);
    
        TextView myTextView = (TextView) findViewById(R.id.my_textview);
        myTextView.setText(myKeys[position]);
    
    
        }
    
    }
    

    And its activity_listitem.xml

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">
    
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/my_textview"/>
    
    </LinearLayout>
    

    If you copy past this code it will work.

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

Sidebar

Related Questions

What is the most efficient way to make all nested list items the same
i am making listview of many column and i want to make the list
I have a list view with items that hold 2 views each(this ListView looks
I want to make only one item in the parent list expand at a
I want to make sure all getters of the classes in a certain package
So I want to make sure all of my database / network operations are
So I have: 01.jpg 02.jpg 3.jpg 4.jpg 05.jpg and want to make them all
I want to make sure that all 3 conditions result in the same answer
HI all I want to make one app for iPhone 2.2.* and for version
I want to make one website for all PC, IPhone, Blackberry, Windows Mobile (IE

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.