title: How i will use Search in customized List VIew
body: <p>I am  taking too  much time on customized search.<br>
  Can anyone  tell me , How I will implement it in my code.Plz help
  I already get a data in list, I have edit box , but I do'nt know, How it will implement  in Using  Filterable class or how I will use
   <code>addTextChangedListener(){}</code>  in this code.</p>
  
  <pre><code>  editTxt.addTextChangedListener(new TextWatcher() {
  
       @Override
       public void onTextChanged(CharSequence s, int start, int before, int count) {
  
       }
  
       @Override
       public void beforeTextChanged(CharSequence s, int start, int count,
               int after) {
  
       }
  
       @Override
       public void afterTextChanged(Editable s) {
       }
   });
  </code></pre>
  
  <p>My code is 
  <strong>MainSearch.java</strong> ,Where I will get list .</p>
  
  <p>In this call , where I will implement the search code ..
  I have little bit idea , If I will save all list items in arrayList and  will compare       all those value  with editText value. It may be provide the solutions. Not sure about it.  </p>
  
  <pre><code>public class MainSEarch extends Activity {
  
      // Progress Dialog
          private ProgressDialog pDialog;
      ListView list;
      LazyAdapter adapter;
  
      // Connection detector
          ConnectionDetector cd;
  
          // Alert dialog manager
          AlertDialogManager alert = new AlertDialogManager();
  
  
  
          ArrayList&lt;HashMap&lt;String, String&gt;&gt; contactList;
      // Search EditText
     EditText inputSearch;
     int textlength = 0;
  
  
  
  
      // url to make request
      String url = "URl NOT HERE But like  as  http://api.androidhive.info/contacts/"; 
  
  
      // JSON Node names
          static final String TAG_CONTACTS = "userinfo";
           static final String TAG_ID = "id";
            static final String TAG_NAME = "name";
            static final String TAG_EMAIL = "email";
            static final String TAG_PHONE = "cb_phonenumber";
  
      // contacts JSONArray
      JSONArray userinfo = null;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.list_search);
          inputSearch = (EditText) findViewById(R.id.editText1); // Search Box
  
          cd = new ConnectionDetector(getApplicationContext());
  
         // Check for internet connection
         if (!cd.isConnectingToInternet()) {
             // Internet Connection is not present
             alert.showAlertDialog(MainSEarch.this, "Internet Connection Error",
                     "Please connect to working Internet connection", false);
             // stop executing code by return
             return;
         }
  
  
  
          // Hashmap for ListView
           contactList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
  
          // Loading Agents list JSON in Background Thread
                  new LoadAgentList().execute();
  
  
                  inputSearch.addTextChangedListener(new TextWatcher() {
  
                      @Override
                      public void onTextChanged(CharSequence s, int start, int before, int count) {
              //what should I do in this method.plz provide some solutions.           
  
                          }
  
                      @Override
                      public void beforeTextChanged(CharSequence s, int start, int count,
                              int after) {
  
                      }
  
                      @Override
                      public void afterTextChanged(Editable s) {
                      }
                  });     
  
      }
  
  
  
      /**
       * Background Async Task to Load all Albums by making http request
       * */
      class LoadAgentList extends AsyncTask&lt;String, String, String&gt; 
      {
  
  
      /** *
           * Before starting background thread Show Progress Dialog
           * */
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              pDialog = new ProgressDialog(MainSEarch.this);
              pDialog.setMessage("Agents List ...");
              pDialog.setIndeterminate(false);
              pDialog.setCancelable(false);
              pDialog.show();
          }
  
          @Override
          protected String doInBackground(String... params) {
              // TODO Auto-generated method stub
  
  
  
              // Creating JSON Parser instance
                      JSONParser jParser = new JSONParser();
  
                      // getting JSON string from URL
                      JSONObject json = jParser.getJSONFromUrl(url);
  
                      try{
  
                          // Getting Array of Contacts
                          userinfo = json.getJSONArray(TAG_CONTACTS);
  
                          // looping through All Contacts
                          for(int i = 0; i &lt; userinfo.length(); i++){
                              JSONObject c = userinfo.getJSONObject(i);
  
                              // Storing each json item in variable
                              String id = c.getString(TAG_ID);
                              String name = c.getString(TAG_NAME);
                              String email = c.getString(TAG_EMAIL);
                              String mobile = c.getString(TAG_PHONE);
  
  
  
  
                              // creating new HashMap
                              HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  
                              // adding each child node to HashMap key =&gt; value
                              map.put(TAG_ID, id);
                              map.put(TAG_NAME, name);
                              map.put(TAG_EMAIL, email);
                              map.put(TAG_PHONE, mobile);
  
                              // adding HashList to ArrayList
                              contactList.add(map);
                          }
                      }
                          catch (JSONException e) {
                              e.printStackTrace();
                          }
  
              return null;
          }
  
  
  
              @Override
              protected void onPostExecute(String file_url) {
                  // dismiss the dialog after getting all albums
                  pDialog.dismiss();
                  // updating UI from Background Thread
                  runOnUiThread(new Runnable() {
                      public void run() {
  
  
                          list=(ListView)findViewById(R.id.mylist);
  
                          // Getting adapter by passing xml data ArrayList
                          adapter=new LazyAdapter(MainSEarch.this,contactList);      
                          list.setAdapter(adapter);
                      }
                  });
  
              }
  
      }
  </code></pre>
  
  <p>My Second Class is <strong>LazyAdapter</strong>: Which will show how getView() 
  method inflate the view and how lazy list will work code is 
  what shold I do in this class </p>
  
  <pre><code>public class LazyAdapter extends BaseAdapter {
  
      private Activity activity;
      private ArrayList&lt;HashMap&lt;String, String&gt;&gt; data;
      private static LayoutInflater inflater=null;
  
      public LazyAdapter(Activity a, ArrayList&lt;HashMap&lt;String, String&gt;&gt; d) {
          activity = a;
          data=d;
          inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
      }
  
  
      @Override
      public int getCount() {
          // TODO Auto-generated method stub
          return data.size();
      }
  
      @Override
      public Object getItem(int arg0) {
          // TODO Auto-generated method stub
          return null;
      }
  
      @Override
      public long getItemId(int arg0) {
          // TODO Auto-generated method stub
          return 0;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          // TODO Auto-generated method stub
           View vi=convertView;
              if(convertView==null)
                  vi = inflater.inflate(R.layout.list_item, null);
  
              TextView name = (TextView)vi.findViewById(R.id.name); // name
              TextView email = (TextView)vi.findViewById(R.id.email); //  email
              TextView phone = (TextView)vi.findViewById(R.id.mobile); // phone
  
  
              HashMap&lt;String, String&gt; song = new HashMap&lt;String, String&gt;();
              song = data.get(position);
  
              // Setting all values in listview
              name.setText(song.get(MainSEarch.TAG_NAME));
              email.setText(song.get(MainSEarch.TAG_EMAIL));
              phone.setText(song.get(MainSEarch.TAG_PHONE));
  
  
  
  
          return vi;
      }
  
  
  
  
  }
  </code></pre>
  
  <p>What change should be there in my code , that my search will be execute .
   Plz I am beginner in Android. 
   Thanks in Advance</p>