Android AutoCompleteTextView unexpected behaviour
<p>I am using AutoCompleteTextView in my application but it works unexpectedly. AutoComplete list show the unwanted text from list which i am not looking for but when i selected this text and remove focus from autocomletetextview than it set the proper text to the autocompletetext field. The other problem is that i want to gain the id of the selected text in the autocompletetext field i am associating this id when i am populating a list in the custom adaptor for autocompletetextview.
Here is the code i am using.</p>

<pre><code>autoComMarker = (AutoCompleteTextView) findViewById(R.id.auto_rainfall_of_markaz_id);
autoComMarker.setThreshold(1);
CustomMarkazAdapter adapter = new CustomMarkazAdapter(getBaseContext(),     R.layout.custom_auto_com_listview, marqazList);
autoComMarker.setAdapter(adapter);


autoComMarker.setOnItemClickListener(new OnItemClickListener() {
    public void onItemClick(AdapterView&lt;?&gt; arg0, View view,
                int position, long arg3) {
            autoComMarker.setTag(view.getTag());
            Log.e("Markaz list", ""+view.getTag());
        }
    });
</code></pre>

<p>Here is the code for CustomMarkazAdapter:</p>

<pre><code>public class CustomMarkazAdapter extends ArrayAdapter&lt;Markaz&gt;{

private ArrayList&lt;Markaz&gt; items;
private Context CurrentContext;
private Markaz CurrentItem;

public CustomMarkazAdapter(Context context, int textViewResourceId,
        ArrayList&lt;Markaz&gt; objects) {
    super(context, textViewResourceId, objects);

    items =  objects;
    CurrentContext = context;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {

     if ((items == null) || ((position + 1) &gt; items.size()))
        return convertView; //Can't extract item

   CurrentItem = (Markaz)items.get(position);    

    LayoutInflater vi = (LayoutInflater)CurrentContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    convertView = vi.inflate(R.layout.custom_auto_com_listview, null);      
    TextView text = (TextView) convertView.findViewById(R.id.custom_auto_com_text);

    text.setText(CurrentItem.getMarkazName());
    convertView.setTag(CurrentItem.getMarkazID());
    Log.e(CurrentItem.getMarkazName(),""+CurrentItem.getMarkazID());
    return convertView;
}
</code></pre>

<p>}</p>

<p>The markazID i am setting here is not that i am looking for, its sets the markaz id according to the autocompletelistview item position.which i am not needed i need the markaz id which i am passed with the markazList.
Please help me, any help whould be very appreciated.</p>
