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 simple ListView that gets populated using an array of SimpleAdapter s.
I have a ListView that uses SimpleAdapter, each row has 2 TextViews, and I
i have my listview activity that works pretty fine but i have an annoying
I have a list view that is built using a simpleAdapter, each row is
I currently have a custom listview with two rows of text in each item,
I'm struggling with updating my ListView after the user have deleted a row from
I have an app that works on the emulator but will intermittently crash when
I have a Listview of layouts that prints out some information, for some reason
I have an Android ListView with rows that include one checkbox, and four text

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.