title: How to get autocompletetextview id?
body: <p>I follow <a href="http://manishkpr.webheavens.com/android-autocompletetextview-example-json/" rel="nofollow">this</a> example to use autocmpletetextview in my project,i want to get id when user select any item,can anyone tell how to get id..</p>
  
  <p>following is json response..so if click on ab then i want to get 1,if i click on abc i want to get 2..</p>
  
  <p>MainActivity</p>
  
  <pre><code>public class MainActivity extends Activity {
  private AutoCompleteTextView acTextView;
  private String idtest;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      acTextView = (AutoCompleteTextView) findViewById(R.id.autoComplete);
  
      final SuggestionAdapter adapter=new SuggestionAdapter(this, acTextView.getText().toString());
      acTextView.setAdapter(adapter);
  
  
      acTextView.setOnItemClickListener(new OnItemClickListener() {
  
  
  
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                  int position, long id) {
              // TODO Auto-generated method stub
              JsonParse jps=new JsonParse();
  
              /* List&lt;SuggestGetSet&gt; list =jps.getParseJsonWCF(acTextView.getText().toString());
  
                  for(int i = 0;i&lt;list.size();i++)
                  {
                    if(list.get(i).getName().equals(acTextView.getText().toString()))
  
                    idtest=list.get(position).getId();
  
  
  
                  }
                     */
  
  
  
  
              SuggestGetSet  selectedSuggestGetSet = 
                       adapter.getAllUpdatedSuggestion().get(position);
  
              Toast.makeText(getApplicationContext(), selectedSuggestGetSet+acTextView.getText().toString(), Toast.LENGTH_SHORT).show();
  
          }
      });
  }
  </code></pre>
  
  <p>adapter</p>
  
  <pre><code>public class SuggestionAdapter extends ArrayAdapter&lt;String&gt; {
  
  protected static final String TAG = "SuggestionAdapter";
  public List&lt;String&gt; suggestions;
  private List&lt;SuggestGetSet&gt; new_suggestions;
  
  public SuggestionAdapter(Activity context, String nameFilter) {
      super(context, android.R.layout.simple_dropdown_item_1line);
      suggestions = new ArrayList&lt;String&gt;();
  }
  
  @Override
  public int getCount() {
      return suggestions.size();
  }
  
  @Override
  public String getItem(int index) {
      return suggestions.get(index);
  }
  
  @Override
  public Filter getFilter() {
      Filter myFilter = new Filter() {
  
          @Override
          protected FilterResults performFiltering(CharSequence constraint) {
              FilterResults filterResults = new FilterResults();
              JsonParse jp=new JsonParse();
              if (constraint != null) {
                  // A class that queries a web API, parses the data and
                  // returns an ArrayList&lt;GoEuroGetSet&gt;
                  new_suggestions =jp.getParseJsonWCF(constraint.toString());
                  suggestions.clear();
                  for (int i=0;i&lt;new_suggestions.size();i++) {
                      suggestions.add(new_suggestions.get(i).getName());
  
                  }
  
                  // Now assign the values and count to the FilterResults
                  // object
                  filterResults.values = suggestions;
                  filterResults.count = suggestions.size();
              }
              return filterResults;
          }
  
          @Override
          protected void publishResults(CharSequence contraint,
                  FilterResults results) {
              if (results != null &amp;&amp; results.count &gt; 0) {
                  notifyDataSetChanged();
              } else {
                  notifyDataSetInvalidated();
              }
          }
      };
      return myFilter;
  }
  
  public List&lt;SuggestGetSet&gt;  getAllUpdatedSuggestion(){
        return this.new_suggestions;
      }
  </code></pre>
  
  <p>}
  response</p>
  
  <pre><code>{"results":[{"id":"1","name":"ab"},{"id":"2","name":"abc"},{"id":"3","name":"bc"},{"id":"4","name":"bcd"},{"id":"5","name":"cd"},{"id":"6","name":"cde"},{"id":"7","name":"ef"},{"id":"8","name":"efg"},{"id":"9","name":"hi"},{"id":"10","name":"hig"},{"id":"11","name":"jk"},{"id":"12","name":"jkl"},{"id":"13","name":"mn"},{"id":"14","name":"mno"},{"id":"15","name":"pq"},{"id":"16","name":"pqr"},{"id":"17","name":"st"},{"id":"18","name":"stu"},{"id":"19","name":"vw"},{"id":"20","name":"vwx"},{"id":"21","name":"yz"},{"id":"22","name":"yza"}]}
  </code></pre>