So reading from my Firebase database seen here by using the following code I have managed to get a 'data snapshot' of the first item in my database:
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference myRef = FirebaseDatabase.getInstance().getReference("messages");
myRef.orderByPriority().limitToFirst(1).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Log.e("data:", ""+dataSnapshot.getChildren());
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.e(TAG, "The read failed: " );
}
});
This returns:
datasnapshot: "DataSnapshot {key = message, value = {ygmailcom100={name=tom, message=kys, email=y@gmail.com}} }"
My question is now what...how do I access these different bits of data(name, msg, email(also the parent of these three bits of data, the 'ygmailcom100 'bit)) and put their data into strings. Also once i have read the data to strings how do i go about deleting that value from the message key.
I apologise for my ignorance as i am new to software development but any insight will be much appreciated.