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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:48:31+00:00 2026-06-12T00:48:31+00:00

I have an ArrayAdapter whose getView sets the items in the listview with data.

  • 0

I have an ArrayAdapter whose getView sets the items in the listview with data. When i click a row in the listview i’d like to start another activity, (which i can do), but send that activity some of the data to present in another view.

How can i make the data from getView accessible in the onItemClick method?

@Override
        public View getView(int position, View convertView, ViewGroup parent) {


            LayoutInflater inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

            View rowView = inflater.inflate(R.layout.rotarowlayout, parent,
                    false);

            TextView startTime = (TextView) rowView
                    .findViewById(R.id.rowstarttime);
            TextView duration = (TextView) rowView
                    .findViewById(R.id.rowduration);
            TextView status = (TextView) rowView.findViewById(R.id.rowstatus);
            TextView name = (TextView) rowView.findViewById(R.id.rowclientname);
            TextView actualTimeIn = (TextView) rowView.findViewById(R.id.rowactualtimein);
            TextView actualTimeOut = (TextView) rowView.findViewById(R.id.rowactualtimeout);

            String record = list.get(position).toString();
            String[] itemsInRecord = record.split(",");
            Log.e(TAG, "itemin record = " + itemsInRecord.length);
            String[] recordItem = new String[itemsInRecord.length];

            for (int x = 0; x < itemsInRecord.length; x++) {

                recordItem[x] = itemsInRecord[x];

            }

            //set date above listview

            textViewDate.setText("Rota For " + recordItem[0].substring(1, 11));


            String withoutBraket = recordItem[0].substring(11);
            String withoutSecs = withoutBraket.substring(0, 6);

            Log.e(TAG, "recordItem = " + recordItem[2]);

            String _statusString = recordItem[2].toString().trim();

            if(_statusString.equalsIgnoreCase("Completed")){

                statusField = "c";

            }else if(_statusString.equalsIgnoreCase("NCR")){

                statusField = "NCR";

            }else if(_statusString.equalsIgnoreCase("Waiting")){

                statusField = "W";
            }

            Log.e(TAG, "statusField = " + statusField);

            startTime.setText(withoutSecs+"     " );
            duration.setText( recordItem[1]+" mins     ");
            status.setText( statusField);
            name.setText( "     " + recordItem[3] + recordItem[4]);
            callID = recordItem[5];
        //  needName = recordItem[6];
            actualTimeIn.setText("This call was completed at " + recordItem[6] + " - ");

            if( ! recordItem[7].toString().trim().equalsIgnoreCase(  "]")){


            String stripBracket = recordItem[7].toString().trim();
            Log.e(TAG, "stripBracket = " + stripBracket);
            String stripBracket2 = stripBracket.substring(0,5);
            Log.e(TAG, "SB after split = " + stripBracket2 );
            actualTimeOut.setText(stripBracket2);
            }

            return rowView;

        }

.

@Override
    public void onItemClick(AdapterView<?> parent, View view, int position,
            long id) {

        Log.e(TAG, "inside onItemClick");
Intent i = new Intent(GetRota.this, someOtherActivity.class);
    i.putsomedata;
    startActivity(i);

    }
  • 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-12T00:48:32+00:00Added an answer on June 12, 2026 at 12:48 am

    By Using setTag() and getTag() methods you can get data from the adapter in onItemClick(). like this

    in adapter class

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {           
    
        rowView.setTag(yourdata_object);
        return rowView;
    }
    

    in on item click

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    
       YourDataObject item = (YourDataObject ) view.getTag();
       Intent i = new Intent(GetRota.this, someOtherActivity.class);
       i.putsomedata;
       startActivity(i);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ArrayAdapter powering a ListView . I would like to change the
I have a ListView that has a custom ArrayAdapter with a custom XML row.
I have a dynamic ListView which uses an ArrayAdapter . When a name is
I have a ListView that is filled with items of an ArrayAdapter. Now I
I have a custom ListView that uses a custom ArrayAdapter (which basically just overrides
i have a ListView (lvProperties) whose adapter is a custom ListAdapter (not an ArrayAdapter).
I have an ArrayAdapter which is hooked up to my ListView . I really
I have used ListView and bounded my custom ArrayAdapter to it. Have setOnItemClickListener(...) bound
I have a ListView with a custom Adapter that extends ArrayAdapter. It's a ArrayAdapter
I have created a listview using the default ArrayAdapter. However, to select an item

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.