阅读来自firebase android的达拉



Firebase请参阅我的数据库样式的图片。我无法读取和匹配和密码与用户名,我在这里分享我的代码。

public void onClickLogInAdmin(View view)
{
//        //PRE-DEFINED ADMIN PROFILES
// Read from the database
ref=ref.child("AdminCredentials");
ref.addListenerForSingleValueEvent(new ValueEventListener()
{
@Override
public void onDataChange(DataSnapshot tasksSnapshot)
{
for (DataSnapshot snapshot: tasksSnapshot.getChildren())
{
String password = (String) snapshot.child("f190191").child("password").getValue();
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {}
});
}

试试这个

public void onClickLogInAdmin(View view)
{
// PRE-DEFINED ADMIN PROFILES
// Read from the database
ref=ref.child("AdminCredentials");
ref.addListenerForSingleValueEvent(new ValueEventListener()
{
@Override
public void onDataChange(DataSnapshot tasksSnapshot)
{
for (DataSnapshot snapshot: tasksSnapshot.getChildren())
{
if(snapshot.getKey().equals("f190191")) {
String password = (String) snapshot.child("password").getValue();
}
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {}
});
}

相关内容

  • 没有找到相关文章

最新更新