/** * This class is an example of how to use FirebaseListAdapter. It uses the ExampleObject class to encapsulate the * data for each individual chat message */ public class ExampleAdapter extends FirebaseListAdapter { @InjectView(R.id.example_list_item) TextView exampleView; public DealListAdapter(Query ref, Activity activity, int layout) { super(ref, ExampleObject.class, layout, activity); this.context = activity.getApplicationContext(); } /** * Bind an instance of the ExampleObject class to our view. This method is called by FirebaseListAdapter * when there is a data change, and we are given an instance of a View that corresponds to the layout that we passed * to the constructor, as well as a single ExampleObject instance that represents the current data to bind. * * @param view A view instance corresponding to the layout we passed to the constructor. * @param example An instance representing the current state of a message */ @Override protected void populateView(View view, ExampleObject example) { ButterKnife.inject(this, view); // populate the list element exampleView.setText(example.getText()); } @Override protected List filters(List models, CharSequence filter) { List filterList = new ArrayList<>(); for (int i = 0; i < models.size(); i++) { /* implement your own filtering logic * and then call filterList.add(models.get(i)); */ } return filterList; }