因为我能够从Firebase检索数据,但是对于Android中的单用户数据库。 我只想从没有用户身份验证登录的情况下从firebase插入的数据库中获取数据。
我在logcat中遇到错误:
(Me.Ocjena1 = 2 Or Me.Ocjena1 = 3 Or Me.Ocjena1 = 4 Or Me.Ocjena1 = 5)
这是我的代码:
With Me
If .Ocjena1 > 1 And .Ocjena1 < 6 Then
If .Ocjena2 = 1 And IsNull(.Ocjena3) Then
.Konacna_ocjena = 1
ElseIf .Ocjena2 > 1 And .Ocjena2 < 6 And IsNull(.Ocjena3) Then
.Konacna_ocjena = (.Ocjena1 + .Ocjena2) / 2
ElseIf .Ocjena2 = 1 And .Ocjena3 > 1 And .Ocjena3 < 6 Then
.Konacna_ocjena = (.Ocjena1 + .Ocjena3) / 3
ElseIf IsNull(.Ocjena2) And IsNull(.Ocjena3) Then
.Konacna_ocjena = .Ocjena1
End If
End With
这是我的用户信息代码:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
答案 0 :(得分:0)
使用迭代器,您将能够完成此任务。
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot data: dataSnapshot.getChildren()){
userinfo user = data.getValue(userinfo.class);
Log.d(TAG, "User name: " + user.getName() + ", mobile: "
+ user.getMob() + ", Vehicle " + user.getVehicle() + ", Address " +
user.getAdd());}
}