me gustaria que me explicaran coomo puedo adaptar m icodigo a un AsyncTask
este es mi codigo y si funciona, me gustaria que desplegara un mensaje de "Buscando en la base de datos " y se que la mejor forma es con un AsyncTask
package com.example.masterapp;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
public class ResUsers extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_res_users);
        //final String user = getIntent().getExtras().getString("usuario");
        /*TextView textView1 = (TextView)findViewById(R.id.textView1);
        textView1.setText(usuario);*/
        connect();
    }
    private void connect()
    {
        final String user = getIntent().getExtras().getString("usuario");
        List<NameValuePair> parametros = new ArrayList<NameValuePair>();
        parametros.add(new BasicNameValuePair("usuario",user));
        try
        {
            //Creamos objetocliente se comunicara con el servidor web
            HttpClient httpClient = new DefaultHttpClient();
            //creamos uno tro objeto y pasamos url
            //HttpPost httpPost = new HttpPost("http://192.168.1.94/android/agregar.php"); red SNL2
            HttpPost httpPost = new HttpPost("http://192.168.0.190/android/select2.php");
            //Enviamos el codigo preparamo s la lista para pasar
            httpPost.setEntity(new UrlEncodedFormEntity(parametros));
            //creamos uno tro objeto y pasamos url
            HttpResponse response = httpClient.execute(httpPost);
            //obtenemos el estring resultante
            HttpEntity entity = response.getEntity();
           String data = EntityUtils.toString(entity);
               try 
                {
                     //el Array que trae Los Datos
                   JSONArray json = new JSONArray(data);
                       for(int i = 0; i < json.length(); i++)
                       {
                        JSONObject objeto = json.getJSONObject(i);
                        String usuario = objeto.getString("user");
                        String pasword = objeto.getString("pass");
                        String nombre = objeto.getString("nombre");
                        Toast.makeText(ResUsers.this, usuario + pasword + nombre, Toast.LENGTH_SHORT).show();
                       }
          } catch (JSONException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
          }
            //String text = EntityUtils.toString(entity);
        //  Toast.makeText(Agregar.this, text, Toast.LENGTH_SHORT).show();
        //  Limpiar();
        }
        catch(ClientProtocolException e)
        {
            Log.e("Lg_tag","IOException");
            e.printStackTrace();
        }
        catch(IOException e)
        {
            Log.e("Lg_tag","IOException");
            e.printStackTrace();
        }
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.res_users, menu);
        return true;
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}


