Android 应用程序崩溃与 NullPointerException 在 ChoreoGrapher
我有以下代码,试图在ListView中创建一个简单的ListAdapter(我以前有这个代码工作,这是我唯一改变过的东西的地方):
public BuddyListAdapter(Context context, HashMap<String, Buddy> hashMap) {
buddyList = new ArrayList<Buddy>(hashMap.values());
mInflater = LayoutInflater.from(context);
ctx = context;
}
当单步执行时,什么也没发生,但是当运行时,我得到一个 in ,当我创建一个空的 ,它不会崩溃:NullPointerException
ChoreoGrapher.doCallbacks
ArrayList
public BuddyListAdapter(Context context, HashMap<String, Buddy> hashMap) {
buddyList = new ArrayList<Buddy>();
mInflater = LayoutInflater.from(context);
ctx = context;
}
是什么,为什么它会使我的应用程序崩溃?ChoreoGrapher
我完全被困在可能是什么问题,或者如何找出问题所在。Eclipse 调试器或崩溃信息并没有真正的帮助。
整个堆栈跟踪如下所示:
Thread [<1> main] (Suspended (exception NullPointerException))
Choreographer.doCallbacks(int, long) line: 558
Choreographer.doFrame(long, int) line: 525
Choreographer$FrameDisplayEventReceiver.run() line: 711
Handler.handleCallback(Message) line: 615
Choreographer$FrameHandler(Handler).dispatchMessage(Message) line: 92
Looper.loop() line: 137
ActivityThread.main(String[]) line: 4745
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 511
ZygoteInit$MethodAndArgsCaller.run() line: 786
ZygoteInit.main(String[]) line: 553
NativeStart.main(String[]) line: not available [native method]
我也有一个主要活动。当它不执行任何操作时,列表视图不会崩溃。但是,在打开列表视图之前,我从中删除了所有回调。Handler