OnItemSelectedListener fetching wrong position values from autocompletetextview in android
===

    Iam fetching items from xml which contains 6 items i.e organization id,organization name, organization address,organization url,emailid,pincode
    I have made an arraylist of each item.
    Iam fetching arraylist of "organization name" and dumping it into autotextview
    There is an edittext box,when the name is selected in the autotextview the associated organization id of the organization email gets displayed in the edittext box.
    now depending on "name" selected, I want associated "id_org" number of the name
    here comes the problem - whenever i select the "organization name" it diplays a random "organization id" number 

For example if i select organization asa Samsung it gives me id as 62 or some other which is present in the xml.
Thanks in advance

<h3>The XML file</h3>
<b>
 

    <Organization>
        <id_org>62</id_org>
        <Name>TCS</Name>
        <Email>acx@tcs.com</Email>
        <Address>dfgghh</Address>
        <URL>www.dghjkk.com</URL>
        <PostCode>3666</PostCode>
      </Organization>
      <Organization>
        <id_org>63</id_org>
        <Name>Samsung</Name>
        <Email>sdff@rrgg.com</Email>
        <Address>ydfgg</Address>
        <URL>www.dgjjj.com</URL>
        <PostCode>3666</PostCode>
      </Organization>

</b>


<h3>Creadentials of the code </h3>
1."autotext_org" is autocomplete textview 
2."edittext_orgid" is edit text
3."data" is my xml file
4."getId" is the arraylist of id in "data" xml


<h3>Code for autotextcomplete view</h3>

    autotext_org.setOnItemSelectedListener(new OnItemSelectedListener(){
    
    public void onItemSelected(AdapterView<?> arg0, View arg1, int position,
    long id) {
    String name = ((TextView)arg1).getText().toString();
    
    String id_org = data.getId().get(position).toString();
    
    Log.v("ID-org-->",id_org);
    
    edittext_orgid.setText(id_org);
    
    }
    
    public void onNothingSelected(AdapterView<?> arg0) {
    
    }
    
    });
