在这里,我尝试将所有 eventLatitude、eventLongitude 存储在 arrayLists 中:
到目前为止我尝试过:
`ParseQuery<ParseObject> query = new ParseQuery<ParseObject>(
"GreenMarkers");
query.orderByDescending("_created_at");
try {
ob = query.find();
} catch (ParseException e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
for (ParseObject greenmarkers : ob) {
eventLatitudeList.add((String) greenmarkers.get("eventLatitude"));
eventLongitudeList.add((String) greenmarkers.get("eventLongitude"));
}`
但是在将值存储在arraylist日志中时出现错误是行不通的
10-10 17:22:25.021: E/AndroidRuntime(21178): FATAL EXCEPTION: main
10-10 17:22:25.021: E/AndroidRuntime(21178): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tukutane/com.tukutane.StartActivity}: java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.String
10-10 17:22:25.021: E/AndroidRuntime(21178): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2114)
10-10 17:22:25.021: E/AndroidRuntime(21178): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2139)
10-10 17:22:25.021: E/AndroidRuntime(21178): at android.app.ActivityThread.access$700(ActivityThread.java:143)
10-10 17:22:25.021: E/AndroidRuntime(21178): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
10-10 17:22:25.021: E/AndroidRuntime(21178): at android.os.Handler.dispatchMessage(Handler.java:99)
10-10 17:22:25.021: E/AndroidRuntime(21178): at android.os.Looper.loop(Looper.java:137)
10-10 17:22:25.021: E/AndroidRuntime(21178): at android.app.ActivityThread.main(ActivityThread.java:4960)
10-10 17:22:25.021: E/AndroidRuntime(21178): at java.lang.reflect.Method.invokeNative(Native Method)
10-10 17:22:25.021: E/AndroidRuntime(21178): at java.lang.reflect.Method.invoke(Method.java:511)
10-10 17:22:25.021: E/AndroidRuntime(21178): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
10-10 17:22:25.021: E/AndroidRuntime(21178): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
10-10 17:22:25.021: E/AndroidRuntime(21178): at dalvik.system.NativeStart.main(Native Method)
10-10 17:22:25.021: E/AndroidRuntime(21178): Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.String
10-10 17:22:25.021: E/AndroidRuntime(21178): at com.tukutane.StartActivity.onCreate(StartActivity.java:131)
10-10 17:22:25.021: E/AndroidRuntime(21178): at android.app.Activity.performCreate(Activity.java:5203)
10-10 17:22:25.021: E/AndroidRuntime(21178): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
10-10 17:22:25.021: E/AndroidRuntime(21178): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2078)
我认为我获取所有 eventLatitude、eventLongitude 值和存储的方式不正确,请帮助我。