Android Hashmap Failed in showing up inside the listView
<p>I am stuck in this hashmap problem when copying the key. (Android)</p>

<p>Initially I had a xml file similar to this</p>

<pre><code>&lt;many_people&gt;
  &lt;people&gt;
    &lt;id&gt;1&lt;/id&gt;
     &lt;name&gt;Johnson&lt;/name&gt;
     &lt;tel_num&gt;12345678&lt;/tel_num&gt;
  &lt;/people&gt;
     .
     .
     .
&lt;/many_people&gt;
</code></pre>

<p>so i created arraylist with hashmap to store the whole xml</p>

<pre><code>for (int i = 0; i &lt; nl.getLength(); i++) {
        map = new HashMap&lt;String, String&gt;();
        Element e = (Element) nl.item(i);
        map.put(KEY_ID, parser.getValue(e, KEY_ID));
        map.put(KEY_NAME, parser.getValue(e, KEY_NAME));
        map.put(KEY_TELNUM, parser.getValue(e, KEY_TELNUM));

        // adding HashList to ArrayList
        peopleList.add(map);
    }
</code></pre>

<p>I used onItemClickListener to capture the input from AutoCompleteTextView so that I can compare the input with the xml. The peopleList will later be used in listView.</p>

<p>For example:
input - Johnson
Compare with , if found  then my list view will show Johnson's name with contact together. The problem is here, if I have 2 Johnson, the listView only read my first johnson in the xml.
I do not know how to compare the input to the xml.
Below is my code:</p>

<pre><code>for (HashMap&lt;String, String&gt; map : peopleList) {
  if (input.equals(map.get(KEY_NAME))) {
      // At here I created another hashmap with copying the value
      map2.put(KEY_ID, map.get(KEY_ID));
      map2.put(KEY_NAME, map.get(KEY_NAME));
      map2.put(KEY_NAME, map.get(KEY_TELNUM));
      peopleList2.add(map2);
    }
}    
</code></pre>

<p>I successfully to show the first data in my listView but second and third data (same name as Johnson) failed. I not sure this is the way to do or not.</p>
