Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
my app work online my List View wuth simpleadapter fill with hashMap i want add edit text in top of list and when user put word list fitre im used below code but it not working whwn put word in edit text list dont show any thing
please help me please

Java
    @Override
    protected void onPostExecute(Void result) {
        super.onPostExecute(result);

        SimpleAdapter adapter = new SimpleAdapter(
                MainActivity.this, contactList,
                R.layout.list_item, new String[] { TAG_TITLE ,TAG_DATE,TAG_TEASER }, new int[] { R.id.title,R.id.date  ,R.id.teaser
                         });

        setListAdapter(adapter);
    
      EditText mEditText= (EditText) findViewById(R.id.editText);
                  
                   getListView().setTextFilterEnabled(true);
                   adapter.notifyDataSetChanged();
                    String s=mEditText.getText().toString();
                    mEditText.addTextChangedListener(new TextWatcher() {

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

                        }
                        @Override
                        public void afterTextChanged(Editable arg0) {

                        }
                    });
}
}
Posted
Updated 11-May-15 5:33am
v5
Comments
Mohibur Rashid 10-May-15 20:30pm    
On top of the head, Keep two contactList, say original and display. Create the display based on user input and rebuild ListView with SimpleAdapter by passing display list.
Member 10959962 11-May-15 8:20am    
i dont know your solution please more explain im edited the question
Maciej Los 11-May-15 11:38am    
I feel like i've seen it before...
Next time, please use proper formatting!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900