Firebase DatabaseException: Failed to convert value of type java.lang.Long to String

前端 未结 7 1168
挽巷
挽巷 2020-12-01 14:50

com.google.firebase.database.DatabaseException: Failed to convert value of type java.lang.Long to String

is the error I keep getting w

7条回答
  •  爱一瞬间的悲伤
    2020-12-01 15:39

    If you want to access data directly without create any object, You can change datatype with String to long.class

    `String reward = ds.child("reward").getValue(String.class);` 
          to
    `long reward = ds.child("reward").getValue(long.class);`
    

    or

    public String reward;
        to
    public long reward;
    

提交回复
热议问题