I keep getting the stacktrace error below each time I implement
GenericTypeIndicator<List<String>> t = new GenericTypeIndicator<List<String>>() {
};
GenericTypeIndicator<List<String>> t2 = new GenericTypeIndicator<List<String>>() {};
List<String> namelist = snapshot.child("Driver name").getValue(t);
List<String> carlist = snapshot.child("Drivers car").getValue(t2);
if (namelist!=null & carlist!=null){
for(int wee=0;wee<namelist.size();wee++){
driver.add(new Driver(namelist.get(wee).toString(),carlist.get(wee).toString()));
}
The data I sent to firebase is stored as:
"DriversList" : {
"Driver name" : {
"-Js6OJniEqVZAYSNhqbB" : "gvvb",
"-Js7GjPMGNOLurrKk9rC" : "iggvv",
"-Js7GlUlCwIoljJxpFbZ" : "iiggv",
"-Js7GnBCRogiFUfn-ncZ" : "ihccvv",
"-Js7GqGxH2vLYK5tsjjP" : "hhvv",
"-Js7Gs80AoB5eeWci6jW" : "hhgc",
"-Js7Gtm6AGh_QaTUK6fQ" : "ugghh",
"-Js7GyomOIzjtVo3-PVg" : "tyygff",
"-JsPxEhf4tx7O4v7JWMc" : "",
"-JsQBoMqVBF4SzOHF3WA" : "rr",
"-JsQC6TuGqHrBBkdalik" : "eed"
},
"Drivers availability" : {
"-Js6OJozSuUvj5JnuNnW" : "No",
"-Js7GjQ_5YgmnEYKWHrL" : "No",
"-Js7GlVm7onoQd59Yyfq" : "No",
"-Js7GnDPdjseoRVjgwSn" : "No",
"-Js7GqIYy4VSEqu9qZfC" : "No",
"-Js7Gs8VP5mp5bOR1pxR" : "No",
"-Js7Gtmfv2M2p201k3Ra" : "No",
"-Js7Gyvf8JkGwBlh8ZLu" : "No",
"-JsPxEly9iGncA4VWvn2" : "No",
"-JsQBoOE6AbGy1VMBSWp" : "No",
"-JsQC6wGzBXBMz76IXue" : "No"
},
"Drivers car" : {
"-Js6OJoyDlc4DR0IQhJr" : "gvgh",
"-Js7GjQZ6Sb7AOooABt3" : "nbcgg",
"-Js7GlVajAA1B5PeBnn2" : "nvvuuu",
"-Js7GnDOCiWM874f6iL6" : "",
"-Js7GqIYy4VSEqu9qZfB" : "nbcxx",
"-Js7Gs8VP5mp5bOR1pxQ" : "hbccf",
"-Js7Gtmfv2M2p201k3R_" : "hvccf",
"-Js7Gyvf8JkGwBlh8ZLt" : "gghhhg",
"-JsPxElx9XXm0kVLFstN" : "",
"-JsQBoOE6AbGy1VMBSWo" : "dd",
"-JsQC6wF0zgLApv8SwJO" : "ff"
}
Error from stack trace:
06-30 14:35:44.918 2736-2736/com.kate.teme E/AndroidRuntime﹕ FATAL EXCEPTION: main
com.firebase.client.FirebaseException: Failed to bounce to type
at com.firebase.client.DataSnapshot.getValue(DataSnapshot.java:208)
at com.kate.teme.AdminContent$2.onDataChange(AdminContent.java:105)
at com.firebase.client.core.ValueEventRegistration.fireEvent(ValueEventRegistration.java:45)
at com.firebase.client.core.view.DataEvent.fire(DataEvent.java:45)
at com.firebase.client.core.view.EventRaiser$1.run(EventRaiser.java:38)
at android.os.Handler.handleCallback(Handler.java:800)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5371)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Caused by: com.shaded.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
at [Source: java.io.StringReader@42af1900; line: 1, column: 1]
at com.shaded.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:575)
at com.shaded.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:569)
at com.shaded.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.handleNonArray(StringCollectionDeserializer.java:218)
at com.shaded.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.deserialize(StringCollectionDeserializer.java:166)
at com.shaded.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.deserialize(StringCollectionDeserializer.java:156)
at com.shaded.fasterxml.jackson.databind.deser.std.StringCollectionDeserializer.deserialize(StringCollectionDeserializer.java:19)
at com.shaded.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2888)
at com.shaded.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2041)
at com.firebase.client.DataSnapshot.getValue(DataSnapshot.java:206)
????????????at com.kate.teme.AdminContent$2.onDataChange(AdminContent.java:105)
????????????at com.firebase.client.core.ValueEventRegistration.fireEvent(ValueEventRegistration.java:45)
????????????at com.firebase.client.core.view.DataEvent.fire(DataEvent.java:45)
????????????at com.firebase.client.core.view.EventRaiser$1.run(EventRaiser.java:38)
????????????at android.os.Handler.handleCallback(Handler.java:800)
????????????at android.os.Handler.dispatchMessage(Handler.java:100)
????????????at android.os.Looper.loop(Looper.java:194)
????????????at android.app.ActivityThread.main(ActivityThread.java:5371)
????????????at java.lang.reflect.Method.invokeNative(Native Method)
????????????at java.lang.reflect.Method.invoke(Method.java:525)
????????????at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
????????????at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
????????????at dalvik.system.NativeStart.main(Native Method)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…