0
I would like to create a node called "Posts" within each user, but I can only create outside the user. It could help me to create the node within the user?
Here is an example of how I wanted the "Posts" in firebase and how it is:
Here is the Android code that creates the "Posts":
private void addPost(Post post) {
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference myRef = database.getReference("Posts").push();
String key = myRef.getKey();
post.setPostKey(key);
myRef.setValue(post).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
showMessage("Adicionado com sucesso");
popupClickProgress.setVisibility(View.INVISIBLE);
popupAddBtn.setVisibility(View.VISIBLE);
popAddPost.dismiss();
}
});
}
John. From a reformulated question so that it actually expresses its doubt..
– Otávio Reis Perkles
Okay, reworked, thank you
– Joao Paulo