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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:49:39+00:00 2026-05-25T06:49:39+00:00

I have a SimpleAdapter that populates a ListView, but when the user presses an

  • 0

I have a SimpleAdapter that populates a ListView, but when the user presses an item I’d like to be able to get the original HashMap that was used to populate the row that was clicked. Unfortunately it seems that all I can get back is an Object which only supports toString(). Having the String from the view the user clicked is not useful since it is not a unique identifier.

How can I get my data back for the row the user clicked on?

ArrayList<HashMap<String, String>> reformedBundle = new ArrayList<HashMap<String, String>>();
// [...]
mResultsAdapter = new SimpleAdapter(this,
    reformedBundle, R.layout.resultrow,
    new String[] { "ProviderName", "Street", "City" },
    new int[] { R.id.tvField1, R.id.tvField2, R.id.tvField3
});

lvResults.setAdapter(mResultsAdapter);

lvResults.setOnItemClickListener(new OnItemClickListener() {

public void onItemClick(AdapterView<?> parent, View view, int pos, long id) {
            // Here's where I want to get the original HashMap<String, String> so I can query other keys in the HashMap
        }
    });
  • 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-05-25T06:49:40+00:00Added an answer on May 25, 2026 at 6:49 am

    I stored in a member variable.

    private ArrayList<HashMap<String, String>> reformedBundle;
    
    ...
    
    lvResults.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int pos, long id) {
            HashMap<String, String> map = reformedBundle.get(pos);
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a listview with custom rows and that extends SimpleAdapter. Each row consist
I have a ListView that uses SimpleAdapter, each row has 2 TextViews, and I
I have a simple ListView that gets populated using an array of SimpleAdapter s.
i have my listview activity that works pretty fine but i have an annoying
I have asked this question before with other adapters like SimpleAdapter but the solution
I have a ListActivity in which i have used a SimpleAdapter to create a
I have an app that works on the emulator but will intermittently crash when
I have a variable called current which holds the last clicked listview item data.
So i have this listview with my custom XML file that i made for
I have a list view that is built using a simpleAdapter, each row is

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.