I have a list of data on firebase real-time database and i would like to display this data in textview at my android studio user activity. what should i do to dispaly the currently logged user data?
my database:
this is my user profile activity:
This can be done by adding event listener to your firebase ref. Sorry i couldnt see your images so ill just give you an example
FirebaseDatabase database = FirebaseDatabase.getInstance();
threadRef = database.getReference("Thread")
threadRef.orderByChild("time").addValueEventListener(threadListener);
ValueEventListener threadListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot messageThread : dataSnapshot.getChildren()) {
String time = (String) messageThread.child("time").getValue();
mTextViewer.setText(time);
break;
}
}
@Override
public void onCancelled(DatabaseError error) {}
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.