1

I have made my firebaselistoptions and firebase list adapter, so after that I'm trying to show the firebase data into a listview, here is what I have made.

All my firebase rules are in true !

here is a pic of my database

enter image description here

public class MainActivity extends AppCompatActivity  implements SearchView.OnQueryTextListener {

    private SearchView mSearchView;
    private ListView mListView;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mListView = (ListView) findViewById(R.id.list_view);
        DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference().child("Usuarios");


        FirebaseListOptions<String> firebaseListOptions = new FirebaseListOptions.Builder<String>()
                .setQuery(databaseReference, String.class)
                .setLayout(android.R.layout.simple_list_item_1)
                .build();

       FirebaseListAdapter<String> adapter = new FirebaseListAdapter<String>(firebaseListOptions) {
            @Override
            protected void populateView(View v, String model, int position) {

                TextView textView = (TextView) v.findViewById(android.R.id.text1);
                textView.setText(model);
                Log.e("POPULATE",""+textView);

            }
        };

        mListView.setAdapter(adapter);
        mListView.setTextFilterEnabled(true);


    }

The problem is that when I run the app, the users are not showing in my listview, it shows me an empty listview.

  • You've included a picture of the JSON tree in your question. Please replace that with the actual JSON as text, which you can easily get by clicking the Export JSON link in your Firebase Database console. Having the JSON as text makes it searchable, allows us to easily use it to test with your actual data and use it in our answer and in general is just a Good Thing to do. – Rosário Pereira Fernandes Dec 25 '17 at 21:28
  • Possible duplicate of [Android ListView adapter not pushing individual items for chat app - Firebase-Ui 3.1](https://stackoverflow.com/questions/47228262/android-listview-adapter-not-pushing-individual-items-for-chat-app-firebase-ui) – Peter Haddad Dec 25 '17 at 21:35

1 Answers1

0

Your POJO objects variables must be the same as the database.