last day (16 days later) » 

3:11 PM
0
A: Android Custom List View with pictures and sub items search view not working

rajan ksBy which property are you filtering,you can write a method in Adapter according to that,for example your filtering with restaurant name , then write below code private class MyListAdapter extends ArrayAdapter<caloocanDB> { public static ArrayList<coloocanDB> tempRestList = new ArrayList<>

 
i want to search resName, resLoc, resType.
i'm getting an error when I put ` adapter.filter(text);` it does not read any variable or method . because I inserted the public void filter after public view getView
 
can you post logcat ?
 
ops sorry, there are no errors in the program but public void filter is not in used . and when i put adapter.filter(text); the filter is not recognized
 
check the updated answer it will work,remove override and update the filter method as above,it will work for all filters like resType,resLoc,ResName
 
cannot resolve method filter(java.lang.String) to the onQueryChange help :(
 
3:11 PM
do you added filter method to your Adapter,i've edited your Adapter and added filter method in it,copy that and paste
 
done, still error. the searchView is inside the onCreate, and adapter after the onCreate,all in one class
 
hi there
do one thing make your adapter global, your already using instance of your adapter in searchview right? same way
 
global ?
soo i wil put it outside
btw how do i globalize it ahahha sorry noob
I changed private to public
hey are you there ?
 
yep
actually
 
public class caloocan extends AppCompatActivity {
String FIREBASE_URL = "https://restaulist1.firebaseio.com";
Firebase firebaseRef;


private List<caloocanDB> Restau = new ArrayList<>();
SearchView searchView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.caloocan);
Firebase.setAndroidContext(this);
firebaseRef = new Firebase(FIREBASE_URL);
searchView = (SearchView) findViewById(R.id.searchView);
// populateListView();
this is the full program
 
3:25 PM
you already used your adapter in searchView na, so it os accessible over there,i just added filter method in your Adapter which is public,so you can refer it by adapter object,i hope you get it?
 
is my code right ?
i copied your code
 
ArrayAdapter<caloocanDB> adapter = new MyListAdapter();
replace this with below line,it will work like a charm
MyListAdapter adapter = new MyListAdapter();
 
okay . it's used now hahahah hopefully it will work
 
dont forget to upvote :p
 
yup if it works
 
3:30 PM
sure byee happy coding
 
not working :/
when i type inside the searchView. all the items are dissapearing
are you there?
 
 
2 hours later…
5:20 PM
hey
allen
i got it
just one more change
it will work now for sure
just replace the old filter method with new one
ive updated answer
its actually contains not equals
 

  last day (16 days later) »