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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:09:04+00:00 2026-06-11T21:09:04+00:00

I am doing a project that currently requires a list and when a particular

  • 0

I am doing a project that currently requires a list and when a particular item from the list is clicked another list activity appears. Is there any solution as to how to move from one listview activity to another. I am currently using http://www.androidhive.info/2012/02/android-custom-listview-with-image-and-text/ as a reference for my ListView.

  • 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-11T21:09:06+00:00Added an answer on June 11, 2026 at 9:09 pm

    One solution would be:

    Create the second ListView activity and implement the first ListActivity with a OnItemClickListener that opens the second ListViewActivity by using an regular Intent.

        listView = (ListView) findViewById(R.id.mylistview);
            listView.setOnItemClickListener(new OnItemClickListener() {
    
                @Override
                public void onItemClick(AdapterView<?> arg0, View v, int position,
                        long arg3) {
    
                    Intent intent = new Intent(FirstListActivity.this, SecondListActivity.class);
                    Bundle bundle = new Bundle();
                    bundle.putString("pos", position);
                    intent.putExtras(bundle);
                    startActivity(intent);
                }
            });
    

    UPDATE:

    I have wrote an simple example list application. You may use it for insperation. The code that could open the Second list activity is included, but commented out. If you get this example to run, you are getting closer. Then you can try comment out the Intent code.

    package com.adpog.listviewexample;
    
    import android.os.Bundle;
    import android.util.Log;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.AdapterView;
    import android.widget.AdapterView.OnItemClickListener;
    import android.widget.AdapterView.OnItemSelectedListener;
    import android.widget.BaseAdapter;
    import android.widget.ListView;
    import android.widget.Toast;
    import android.app.Activity;
    
    public class MainActivity extends Activity {
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            // Find the ListView resource.   
            ListView mainListView = (ListView) findViewById( R.id.my_list );  
    
            // Set the Adapter as the ListView's adapter.  
            mainListView.setAdapter( new BaseAdapter(){
    
                // Create and populate a List of planet names.  
                String[] planets = new String[] {"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune" };    
    
                @Override
                public int getCount() {
                    return planets.length;
                }
    
                @Override
                public Object getItem(int pos) {
                    return planets[pos-1];
                }
    
                @Override
                public long getItemId(int pos) {
                    return 0;
                }
    
                @Override
                public View getView(int pos, View view, ViewGroup viewgroup) {
                    if(view == null){
                        /**
                         <?xml version="1.0" encoding="utf-8"?>
                            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                android:orientation="horizontal" 
                                android:layout_width="fill_parent"
                                android:layout_height="fill_parent">
                                <ImageView 
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content" 
                                    android:src="@drawable/ic_launcher"
                                 />
                                <TextView
                                    android:id="@+id/item_text" 
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content" 
                                    android:text="Text not set" />
                            </LinearLayout>
                        */
                        view = View.inflate(getApplicationContext(), R.layout.row, null);
                    }
                    return view;
                }
            });        
    
            mainListView.setOnItemSelectedListener(new OnItemSelectedListener() {
    
                @Override
                public void onItemSelected(AdapterView< ? > arg0, View arg1, int arg2, long arg3) {
                    Log.d("ListView", "Pos: " + arg2 + ", long : "+arg3);
                    Toast.makeText(getApplicationContext(), "Test " + arg2, Toast.LENGTH_SHORT).show();
                    /* Alternative way; opens a new Activity
                    Intent intent = new Intent(this, SecondListViewActivity.class);
                    intent.putExtra("position", pos);
                    startActivity(intent);
                    */
                }
    
                @Override
                public void onNothingSelected(AdapterView< ? > arg0) {
                }
            });
    
            /**
             * Implement an action for each item click.
             */
            mainListView.setOnItemClickListener(new OnItemClickListener() {
    
                @Override
                public void onItemClick(AdapterView< ? > arg0, View arg1, int arg2, long arg3) {
                    Log.d("ListView", "OnClickPos: " + arg2 + ", long : "+arg3);
                    Toast.makeText(getApplicationContext(), "Test " + arg2, Toast.LENGTH_SHORT).show();
                }
            });
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently doing a project in C# that requires rendering MathML for the
I'm doing a homework project that requires this: Below you will find the code
I'm currently working on a project that requires me to match our database of
I am currently working on a project that requires the use of SVN on
I'm using a gsm modem itengo 3800. I'm currently doing a project that interface
I'm currently doing a project that has to be multi-lingual. I need to be
I'm currently working on a project that requires that I have a div stacked
I'm doing a project that use image processing techniques to identify different objects and
i am doing a project that will have multiple channels for clients chatting. Each
I'm doing project on object detection using javacv in that I went through couple

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.