How can I add a search button in a listview?
<p>Hello I'm new in android
I added a search button in a ListView, but I got an Error Ca you help me to resolve this error.</p>

<p>Edit</p>

<p>Error <code>cannot resolve symbol adapter</code>
adapter is a List adapter used in the getuser method</p>

<p>This is my java code</p>

<p>UserFragment.java</p>

<pre><code>   public class UsersFragment extends Fragment implements ListView.OnItemClickListener {
private String JSON_STRING;
private ImageButton btn1;
public static final String URL = "http://10.0.3.2/GetPHP/getuser.php";
public static final String TAG_JSON_ARRAY = "result";
// List view
private ListView listView;
// Search EditText
EditText inputSearch;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootview = inflater.inflate(R.layout.fragment_users, container, false);
    listView  = (ListView)   rootview.findViewById(R.id.listView);
    inputSearch  = (EditText)   rootview.findViewById(R.id.inputSearch);
    listView.setOnItemClickListener(this);
    btn1=(ImageButton) rootview.findViewById(R.id.btn1);
    inputSearch.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
            // When user changed the Text
            (SimpleAdapter) UsersFragment .this.adapter.getFilter().filter(cs);
        }

        @Override
        public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
                                      int arg3) {
            // TODO Auto-generated method stub

        }

        @Override
        public void afterTextChanged(Editable arg0) {
            // TODO Auto-generated method stub
        }
    });
    getJSON();
    return rootview;
}

private void getuser(){
    JSONObject jsonObject = null;
    ArrayList&lt;HashMap&lt;String,String&gt;&gt; list = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
    try {
        jsonObject = new JSONObject(JSON_STRING);
        JSONArray result = jsonObject.getJSONArray(TAG_JSON_ARRAY);

        for(int i = 0; i&lt;result.length(); i++){
            JSONObject jo = result.getJSONObject(i);
            String name = jo.getString("Nom");
            String ref = jo.getString("Reference");

            HashMap&lt;String,String&gt; users= new HashMap&lt;&gt;();

            users.put("name",name);
            users.put("ref",ref);
            list.add(users);
        }

    } catch (JSONException e) {
        e.printStackTrace();
    }

    ListAdapter adapter = new SimpleAdapter(
            getActivity(), list, R.layout.list_row2,
            new String[]{"name","ref"},
            new int[]{R.id.nom, R.id.email2});

    listView.setAdapter(adapter);
}
private void getJSON() {
    class GetJSON extends AsyncTask&lt;Void, Void, String&gt; {
        ProgressDialog loading;
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            loading = ProgressDialog.show(getActivity(), "Téléchargement", "Veuillez patientez...", false, false);
        }
        @Override
        protected void onPostExecute(String s) {
            super.onPostExecute(s);
            loading.dismiss();
            JSON_STRING = s;
            getuser();
        }
        @Override
        protected String doInBackground(Void... params) {
            RequestHandler rh = new RequestHandler();
            String s = rh.sendGetRequest(URL);
            return s;
        }
    }
    GetJSON gj = new GetJSON();
    gj.execute();
}
@Override
public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
    Intent intent = new Intent(getActivity().getApplicationContext(), Viewuser.class);
    HashMap&lt;String, String&gt; map = (HashMap) parent.getItemAtPosition(position);
    String tid = map.get("ref").toString();
    intent.putExtra("ref", tid);
    startActivity(intent);
}
</code></pre>

<p>thanks in advance</p>