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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:22:20+00:00 2026-05-25T16:22:20+00:00

I have an arraylist with multiple hashmaps that contains information that comes from a

  • 0

I have an arraylist with multiple hashmaps that contains information that comes from a sql database

ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();

This arraylist will eventually fill my listview with items (names of people).
When I click on one item I want to send all of the content of that hashmap to another page.
For example:

John <

Now I want to send the hashmap with all the information of John to another android page.
How do I get that information out of the hashmap?

This is my code:

public class Contactenlijst extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.contactview);

    ListView lv;
    lv = (ListView) findViewById(R.id.list);        
    lv.setTextFilterEnabled(true);

    String[] from = new String[] {"naam"};
    int[] to = new int[]{R.id.naam};

    ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
    // Get the data (see above)
    JSONObject json = Database
            .getJSONfromURL("http://fabian.nostradamus.nu/Android/getcontactinfo.php");

    try {
        JSONArray contactinfo = json.getJSONArray("contactlijst");

        // Loop the Array
        for (int i = 0; i < contactinfo.length(); i++) {
            HashMap<String, String> map = new HashMap<String, String>();
            JSONObject e = contactinfo.getJSONObject(i);
            map.put("voornaam", e.getString("staff_name"));
            map.put("achternaam", e.getString("staff_lastname"));
            map.put("geboortedatum", e.getString("staff_dateofbirth"));
            map.put("adres", e.getString("staff_address"));
            map.put("postcode", e.getString("staff_address_postal"));
            map.put("woonplaats", e.getString("staff_address_city"));
            map.put("email", e.getString("staff_email"));
            map.put("telefoon", e.getString("staff_phone"));
            mylist.add(map);
        }
    } catch (JSONException e) {
        Log.e("log_tag", "Error parsing data " + e.toString());
    }

    //array for view
    ArrayList<HashMap<String, String>> mylist2 = new ArrayList<HashMap<String, String>>();
    for(int i = 0; i < mylist.size(); i++){
        HashMap<String,String> map2 = new HashMap<String, String>();
        map2.put("naam", (mylist.get(i).get("voornaam")+" "+(mylist.get(i).get("achternaam"))));
        mylist2.add(map2);
    }
    try{
    lv.setAdapter(new SimpleAdapter(this, mylist2, R.layout.list_item, from, to));
    }catch (Exception e){Log.d("test1","test2");}

    //onclick stuur array naar contactinfo
    lv.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view,
            int position, long id) {
            String text = ((TextView) view).getText().toString();
            Intent i = new Intent(Contactenlijst.this, Contactinfo.class);

            String uittekst[] = text.split(" ");
            String voornaam = uittekst[0].toString();
            String achternaam = uittekst[1].toString();


            startActivity(i);        
        }
      });   
}

}

So it all has to happen under “String achternaam = uittekst[1].toString();”

  • 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-25T16:22:22+00:00Added an answer on May 25, 2026 at 4:22 pm
    for(Hashmap<String, String> map: mylist) {
        for(Entry<String, String> mapEntry: map) {
            String key = mapEntry.getKey();
            String value = mapEntry.getValue();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an android ListActivity that creates multiple buttons (from a database source) via
I have an ArrayList<String> that I'd like to return a copy of. ArrayList has
I have an ArrayList<String> , and I want to remove repeated strings from it.
I have an arraylist that contains items called Room. Each Room has a roomtype
We have multiple threads calling add(obj) on an ArrayList . My theory is that
I have an ArrayList that needs to be read from and written to from
I have an XML file which contains multiple nodes that have children. If the
Possible Duplicates: SQL Multiple Parameter Values SQL Server (2008) Pass ArrayList or String to
I have a HashMap that maps companies to an ArrayList of the products they
I have a ArrayList made up of different elements imported from a db, made

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.