I am doing an Android App. I have been successful in writing to Firebase, I however am having a problem reading from Firebase into a ListView. If anyone can assist in getting th
You can use the Firebase UI library.
Just add the dependency:
dependencies {
// FirebaseUI Database only
compile 'com.firebaseui:firebase-ui-database:1.0.1'
}
Then define a simple class to map your object:
public class MyObject {
private String name;
private String address;
private String dateTime;
public MyObject() {
}
....
}
Then just use something like:
mRef = new Firebase("https://saica-sgb-77a4f.firebaseio.com/Meetings");
mListView = (ListView) findViewById(R.id.ListView);
mAdapter = new FirebaseListAdapter(this, MyObject.class, R.layout.myLayout, mRef) {
@Override
protected void populateView(View view, MyObject myObj, int position) {
//Set the value for the views
((TextView)view.findViewById(R.id.xxx)).setText(myObj.getName());
//...
}
};
mListView.setAdapter(mAdapter);