I have the following code, trying to create a simple ListAdapter in a ListView (I had this code working before and this is the only place I have changed something):
public BuddyListAdapter(Context context, HashMap<String, Buddy> hashMap) {
buddyList = new ArrayList<Buddy>(hashMap.values());
mInflater = LayoutInflater.from(context);
ctx = context;
}
When stepping through, nothing happens, but when running, I get a NullPointerException
in ChoreoGrapher.doCallbacks
, when I create an empty ArrayList
, it doesn't crash:
public BuddyListAdapter(Context context, HashMap<String, Buddy> hashMap) {
buddyList = new ArrayList<Buddy>();
mInflater = LayoutInflater.from(context);
ctx = context;
}
What is the ChoreoGrapher
and why is it crashing my app?
I am completely stuck on what could be the problem, or how to figure out what is wrong. The Eclipse debugger or crash information is not really helping.
The entire stack trace is as follows:
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]
I also have a Handler
in the main activity. When it is not doing anything, the listview doesn't crash. However, I remove all callbacks from it before openning the listview.