我正在尝试创建Snapchat克隆。我停留在该活动应该显示向当前用户发送快照的用户的电子邮件ID列表的部分,实际上该消息甚至没有登录到logcat中。这是代码
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_blank);
list=findViewById(R.id.emails);
id=new ArrayList<>();
ArrayAdapter<String> ada=new ArrayAdapter(this,android.R.layout.simple_list_item_1,id);
list.setAdapter(ada);
try {
FirebaseDatabase.getInstance().getReference().child("users").child(mAuth.getCurrentUser().getUid()).child("snaps").addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
Log.i("first", "created");
Log.i("pug", dataSnapshot.child("from").getValue().toString());
}
@Override
public void onChildChanged(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
}
@Override
public void onChildRemoved(@NonNull DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
catch (Exception e){
Log.e("error",e.getMessage());
}
}
}