android - How to make SearchView using list of objects retreived from firebase? -




i making android app using android studio add student details , retrieve using firebase.i want make activity details of students under 1 activity user allowed make search. function in searchactivity.java retrieve records("studentlist") firebase database

public arraylist<student> getstudentdetails(final arraylist<student>                               arrayliststudent,final listviewadapter adapter) {     firebasedatabase database = firebasedatabase.getinstance();     databasereference fdatabaseroot = database.getreference("studentslist");     fdatabaseroot.orderbychild("name").addvalueeventlistener(new                                                        valueeventlistener() {         @override         public void ondatachange(datasnapshot datasnapshot) {             (datasnapshot areasnapshot : datasnapshot.getchildren()) {                 student stud = areasnapshot.getvalue(student.class);                  arrayliststudent.add(stud);             }                adapter.notifydatasetchanged();         }         @override         public void oncancelled(databaseerror databaseerror) {         }     });     return arrayliststudent; } 

in oncreate() method of searchactivity calling function this: setting adapter listview 'list'

arraylist<student> arrayliststudent=new arraylist<>(); listviewadapter adapter=new listviewadapter(this,arrayliststudent); list.setadapter(adapter); arrayliststudent=getstudentdetails(arrayliststudent,adapter); 

my searchactivity run , displays list of student's name initially.but type in search box,my app crashes. problem?and how fix this?

screenshotbefore crash





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -