当我在我的应用程序中浏览时,有时会出现此错误。我不确定这个错误是随机出现的,我不知道为什么。日志没有显示任何特定于我的应用程序的内容?
我希望有人能给我提示或提示为什么会发生此错误。(最后一次是当我尝试打开一个弹出窗口时,一个快速操作对话框,在第二次使用相同的快速操作对话框后,它在我第三次尝试后再次工作。现在它一直工作,再次?)
08-01 11:09:15.980: ERROR/AndroidRuntime(9579): FATAL EXCEPTION: main
08-01 11:09:15.980: ERROR/AndroidRuntime(9579): java.lang.NullPointerException
08-01 11:09:15.980: ERROR/AndroidRuntime(9579): at android.widget.PopupWindow$PopupViewContainer.dispatchKeyEvent(PopupWindow.java:1445)
08-01 11:09:15.980: ERROR/AndroidRuntime(9579): at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2664)
08-01 11:09:15.980: ERROR/AndroidRuntime(9579): at android.view.ViewRoot.deliverKeyEvent(ViewRoot.java:2629)
08-01 11:09:15.980: ERROR/AndroidRuntime(9579): at android.view.ViewRoot.handleMessage(ViewRoot.java:1935)
08-01 11:09:15.980: ERROR/AndroidRuntime(9579): at android.os.Handler.dispatchMessage(Handler.java:99)
08-01 11:09:15.980: ERROR/AndroidRuntime(9579): at android.os.Looper.loop(Looper.java:143)
08-01 11:09:15.980: ERROR/AndroidRuntime(9579): at android.app.ActivityThread.main(ActivityThread.java:4196)
08-01 11:09:15.980: ERROR/AndroidRuntime(9579): at java.lang.reflect.Method.invokeNative(Native Method)
08-01 11:09:15.980: ERROR/AndroidRuntime(9579): at java.lang.reflect.Method.invoke(Method.java:507)
08-01 11:09:15.980: ERROR/AndroidRuntime(9579): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-01 11:09:15.980: ERROR/AndroidRuntime(9579): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-01 11:09:15.980: ERROR/AndroidRuntime(9579): at dalvik.system.NativeStart.main(Native Method)
这里有更多细节:
QuickAction qa = QuickactionBuilder.showSaveForgetQuickaction();
qa.setOnActionItemClickListener(new QuickAction.OnActionItemClickListener() {
@Override
public void onItemClick(int pos) {
if (pos == 0) { // SAVE
Toast.makeText(ctxHolder.getCtx(), "TODO SAVE", Toast.LENGTH_SHORT).show();
} else if (pos == 1) { // REJECT
Toast.makeText(ctxHolder.getCtx(), "REJECTED", Toast.LENGTH_SHORT).show();
} else { // CANCEL
Toast.makeText(ctxHolder.getCtx(), "CANCEL", Toast.LENGTH_SHORT).show();
}
}
});
qa.show(v);
QuickactionBuilder 只为我创建 QuickAction 对话框。这很简单:(仅展示该方法的基础知识)
QuickAction qa = new QuickAction
ActionItem ai = new ActionItem()
// some setters ...
qa.add(ai)
return qa;