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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:28:44+00:00 2026-06-17T13:28:44+00:00

I have a custom adapter that I’m using to populate a ListView. I have

  • 0

I have a custom adapter that I’m using to populate a ListView. I have an onItemClick() set on the ListView item that changes the displayed fragment to something else.

I want to pass data to the new fragment from the ListView item, but I don’t want to get any of that data from the visible views if I can help it. The custom adapter parses a JSONObject to get the data to populate the ListView. So is there a way that I can access that underlying data outside of the adapter class?

More specifically, I’m trying to put the necessary underlying ListView data into a Bundle and pass that Bundle from the ListView item up to the activity, to then pass into the new fragment.

I also want to get it from the getView() method so I don’t have to duplicate code in another custom public method within the adapter.

  • 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-17T13:28:45+00:00Added an answer on June 17, 2026 at 1:28 pm

    You can do that if your custom adapter overrides the getItem(int position) method and there you should return the object at the given position within your adapter’s dataset.
    After that you can get the clicked data using onItemSelected(AdapterView<?> parent, View view, int position, long id) on the ListView by calling this:

    parent.getAdapter().getItem(position) -> and this is your data corresponding to your clicked item.
    You just have to cast that returned object to whatever your class is and do what you want to it..
    good luck and I hope it helps!

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

Sidebar

Related Questions

I have a ListView powered by a custom adapter that dynamically changes the background
I have a ListView with a custom Adapter that extends ArrayAdapter. It's a ArrayAdapter
I have a ListView with a custom list adapter (that extends BaseAdapter). My list
I have created a custom adapter and added it on the listview. After that
I have a custom ListView adapter that uses multiple layout types. One is the
I currently have a ListView with a custom adapter that gets information describing the
I have a ListView that is being populated with a custom adapter. I'd like
I have a custom implementation of an Array Adapter that I'm using in a
I have a spinner with a custom adapter that I used to set the
I have a ListView with a custom Adapter that creates rows containing TextViews that

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.