How to add AsynTask on AutoCompleteTextView
<p>The bellows code if running successfully now how to add AsynTask on this.</p>

<pre><code>import android.app.Activity;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AutoCompleteTextView;
import android.widget.ImageView;
import android.widget.TextView;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

public class MainActivity extends Activity {

  AutoCompleteTextView txtSearch;
  PeopleAdapter adapter;
  List&lt;People&gt; mList;
  TextView idd;
  ImageView imgspn;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);

    mList = retrievePeople();

    txtSearch = (AutoCompleteTextView) findViewById(R.id.txt_search);
            txtSearch.setThreshold(1);
    adapter = new PeopleAdapter(this, R.layout.activity_main, R.id.lbl_name, mList);
    txtSearch.setAdapter(adapter);

    idd = (TextView) findViewById(R.id.idd);
    imgspn = (ImageView) findViewById(R.id.imgspn);
    imgspn.setVisibility(View.INVISIBLE);

    txtSearch.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
            String Name = mList.get(position).getId();
            idd.setText(Name);
            // Toast.makeText(MainActivity.this,Name
            // ,Toast.LENGTH_LONG).show();
        }
    });

  }

private List&lt;People&gt; retrievePeople() {
    List&lt;People&gt; list = new ArrayList&lt;People&gt;();
    try {
        Class.forName("com.mysql.jdbc.Driver");
        Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://192.168.0.44:3386/stud", "root",
                                "Winpass");
        Statement st = (Statement) con.createStatement();
        ResultSet rs = (ResultSet) st.executeQuery(
                "select name,designation_name,id from umdlv_users ut,t_designation td where ut.designation_id = td.designation_id");
        while (rs.next()) {

            list.add(new People(rs.getString(1), rs.getString(2), rs.getString(3)));
        }
        rs.close();
        st.close();
        con.close();
    } catch (Exception e) {
    }
return list;
}
</code></pre>

<p>}</p>

<p><b> People Class </b></p>

<pre><code>package com.example.actvpep;

     public class People {          
              private String name, lastName, id;            
              public People(String name, String lastName, String id) {
                this.name = name;
                this.lastName = lastName;
                this.id = id;
              }

                public String getId() {
                    return id;
                }

                public void setId(String id) {
                    this.id = id;
                }

                public String getName() {
                    return name;
                }

                public void setName(String name) {
                    this.name = name;
                }

                public String getlastName() {
                    return lastName;
                }

                public void setlastName(String lastName) {
                    this.lastName = lastName;
                }
            }
</code></pre>

<p><b> People Adapter </b></p>

<pre><code>package com.example.actvpep;

import android.content.Context;
            import android.view.LayoutInflater;
            import android.view.View;
            import android.view.ViewGroup;
            import android.widget.ArrayAdapter;
            import android.widget.Filter;
            import android.widget.TextView;

            import java.util.ArrayList;
            import java.util.List;

            public class PeopleAdapter extends ArrayAdapter&lt;People&gt; {

                Context context;
                int resource, textViewResourceId;
                List&lt;People&gt; items, tempItems, suggestions;

                public PeopleAdapter(Context context, int resource, int textViewResourceId, List&lt;People&gt; items) {
                    super(context, resource, textViewResourceId, items);
                    this.context = context;
                    this.resource = resource;
                    this.textViewResourceId = textViewResourceId;
                    this.items = items;
                    tempItems = new ArrayList&lt;People&gt;(items); // this makes the difference.
                    suggestions = new ArrayList&lt;People&gt;();
                }

                @Override
                public View getView(int position, View convertView, ViewGroup parent) {
                    View view = convertView;
                    if (convertView == null) {
                        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                        view = inflater.inflate(R.layout.row_people, parent, false);
                    }
                    People people = items.get(position);
                    if (people != null) {
                        TextView lblName = (TextView) view.findViewById(R.id.lbl_name);
                        TextView tvCode = (TextView) view.findViewById(R.id.tvCode);
                        if (lblName != null)
                            lblName.setText(people.getName());
                        tvCode.setText(people.getlastName());
                    }
                    return view;
                }

                @Override
                public Filter getFilter() {
                    return nameFilter;
                }

                /**
                 * Custom Filter implementation for custom suggestions we provide.
                 */
                Filter nameFilter = new Filter() {
                    @Override
                    public CharSequence convertResultToString(Object resultValue) {
                        String str = ((People) resultValue).getName();
                        return str;
                    }

                    @Override
                    protected FilterResults performFiltering(CharSequence constraint) {
                        if (constraint != null) {
                            suggestions.clear();
                            for (People people : tempItems) {
                                if (people.getName().toLowerCase().contains(constraint.toString().toLowerCase())) {
                                    suggestions.add(people);
                                }
                            }
                            FilterResults filterResults = new FilterResults();
                            filterResults.values = suggestions;
                            filterResults.count = suggestions.size();
                            return filterResults;
                        } else {
                            return new FilterResults();
                        }
                    }

                    @Override
                    protected void publishResults(CharSequence constraint, FilterResults results) {
                        List&lt;People&gt; filterList = (ArrayList&lt;People&gt;) results.values;
                        if (results != null &amp;&amp; results.count &gt; 0) {
                            clear();
                            for (People people : filterList) {
                                add(people);
                                notifyDataSetChanged();
                            }
                        }
                    }
                };
            }
&lt;/pre&gt;
</code></pre>