我遇到了一个我不明白的异常。从设备 350 开始,只有三个这样的。以下是日志本身:
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3724)
at android.view.View.performClick(View.java:4261)
at android.view.View$PerformClick.run(View.java:17356)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3719)
... 11 more
Caused by: java.lang.NullPointerException
at com.ex.MainActivity.ParseQueryMap(MainActivity.java:397)
at com.ex.MainActivity.onClickParse(MainActivity.java:493)
... 14 more
这是我认为错误的来源:
public void onClickParse(View view) {
myMap.clear();
ParseQueryMap();
}
以及来自数据库的查询(ParseQueryMap)
public void ParseQueryMap() {
userLocation = new ParseGeoPoint(location.getLatitude(), location.getLongitude());
ParseQuery query = new ParseQuery("MyObject");
query.findInBackground(new FindCallback() {
public void done(List<ParseObject> myObject, ParseException e) {
if (e == null) {
for (int i = 0; i < myObject.size(); i++) {
commGet = myObject.get(i).getString("Comment");
bugGet = myObject.get(i).getObjectId();
geo1Dub = myObject.get(i).getParseGeoPoint("location").getLatitude();
geo2Dub = myObject.get(i).getParseGeoPoint("location").getLongitude();
}
} else {
Toast.makeText(MainActivity.this, "Error!", Toast.LENGTH_SHORT).show();
}
}
});
有谁知道是什么导致了这个错误?