I'm designing an app in which I used a custom ArrayAdapter and overrided the getView() method in order to fill a subclass of GridView. When I run it I get a NullPointer that I'm fairly certain is because of a variable named "callbacks" in the Choreographer being null. My debug setup shows "callbacks" and "next" (the next callback to be used) to both be null. I'm not too comfortable in my understanding of how a Choreographer works, but I've tried looking through all the Choreographer source code and I wasn't able to figure out exactly how callbacks are created and why my program is not creating any. I've tried switching my custom ArrayAdapter with a normal one just to check that the problem is with my adapter and that was the case.
Custom Adapter:
public class SpaceArrayAdapter extends ArrayAdapter<Space>{
Context context;
int resource;
ArrayList<Space> spaces;
public SpaceArrayAdapter(Context context, int resource, ArrayList<Space> spaces){
super(context, resource, spaces);
this.context = context;
this.resource = resource;
this.spaces = spaces;
}//ends LevelSelectorAdapter()
public static class ViewHolder{
public SpaceView view;
}//ends Class ViewHolder
@Override
public View getView(int position, View convertView, ViewGroup parent){
View view = convertView;
ViewHolder holder;
if(view == null){
LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(resource, null);
holder = new ViewHolder();
holder.view = (SpaceView)view.findViewById(R.id.Space);
view.setTag(holder);
view.setOnClickListener(spaces.get(position).getBoard());
}
else{
holder = (ViewHolder)view.getTag();
}
final Space space = spaces.get(position);
holder.view.setSpace(space);
return view;
}//ends getView()
}//ends Class
Stack Trace:
Choreographer.doCallbacks(int, long) line: 572
Choreographer.doFrame(long, int) line: 532
Choreographer$FrameDisplayEventReceiver.run() line: 735
Handler.handleCallback(Message) line: 730
Choreographer$FrameHandler(Handler).dispatchMessage(Message) line: 92
Looper.loop() line: 137
ActivityThread.main(String[]) line: 5103
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 525
ZygoteInit$MethodAndArgsCaller.run() line: 737
ZygoteInit.main(String[]) line: 553
NativeStart.main(String[]) line: not available [native method]
The only thing that the LogCat said was a bunch of messages all saying that it skipped a couple hundred frames, and that the application is doing too much on the main thread.