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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:45:30+00:00 2026-06-03T07:45:30+00:00

I filled the list with some string values..Then after on item click…I’m able to

  • 0

I filled the list with some string values..Then after on item click…I’m able to see the Toast message for all checked items…Well the issue is that I want to move the indexes/string/position to a string and display it on next tab…But on next tab it gives me the item which I checked first…

protected void onListItemClick(ListView l, View v, int position, long id) {
        //final ViewHolder viewHolder = new ViewHolder();
        SparseBooleanArray sp=getListView().getCheckedItemPositions();

        String str="";
        for(int i=0;i<sp.size();i++)
        {
            str+=items[sp.keyAt(i)]+",";
        }
        Toast.makeText(this, ""+str, Toast.LENGTH_SHORT).show();

        Product.pro_selected= l.getItemAtPosition(position).toString();;

I use the following to display all selected item..

txtPro=(TextView)findViewById(R.id.select_pro_name); 
                txtPro.setText(Product.pro_selected);
  • 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-03T07:45:32+00:00Added an answer on June 3, 2026 at 7:45 am
    protected void onListItemClick(ListView l, View v, int position, long id) {
    
        ArrayList<String> itemSelected = new  ArrayList<String>();
        itemSelected.add(presidents[position]);
     }
    

    This code is placed from you navigate to next activity/Screen

        Intent i = new Intent(getApplicationContext(),Second.class);
        i.putStringArrayListExtra("SelectedItems", itemSelected);
        startActivity(i);
    

    in Second Activity get the value of intent and use it.

    Intent intent = getIntent();
    ArrayList<String> items = new ArrayList<String>();
    items = intent.getStringArrayListExtra("SelectedItems");
    

    This will shows you all selected items.

    for (int i = 0; i < items.size(); i++) {
    
    Toast.makeText(getApplicationContext(), String.valueOf(items.get(i)), Toast.LENGTH_SHORT).show();
    }
    

    To display them in a List extends ListActivity

    ListView listView = getListView();
    listView.setChoiceMode(listView.CHOICE_MODE_NONE);
    
    setListAdapter(new ArrayAdapter<String>
                    (this,android.R.layout.simple_list_item_1,items));
    

    To display Selected items

        @Override
        protected void onListItemClick(ListView l, View v, int position, long id) {
            // TODO Auto-generated method stub
            Toast.makeText(getApplicationContext(), items[position], Toast.LENGTH_SHORT).show();
            super.onListItemClick(l, v, position, id);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have filled List<Object1> Object 1 contain 2 fields (int id & string name)
I have ArrayProxy filled with different values, and after tossing it in iterator and
I recently wrote some javascript code that filled a drop down list based on
I have a list view filled with data. I set up a context menu
The program is supposed to take a file, say data.dat, filled with a list
How do I make a drop-down list that is filled with image items? I
I've created a listview that's filled up with a list of guitars from the
I am working on creating some grails domain objects dynamically and then adding them
I'm trying to use a DataTable, filled by a MySqlDataAdapter, which contains a list
I have the following problem: On a Button-Click I POST some data to the

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.