List View problem
I cannot figure out why it's throwing a NullPointerExce开发者_开发知识库ption on line 28, which is return mClasses.size();
and I cant figure out why, Any Ideas?
private ArrayList<String> mClasses;
public int size;
public mAdapter(Context context,ArrayList<String> classes,ArrayList<Integer> checked) {
mInflater = LayoutInflater.from(context);
mClasses = classes;
mChecked = checked;
}
public int getCount() {
return mClasses.size();
}
..etc
}
My guess is the "classes" your a passing is null. easily checkable with a
if(calsses == null)Log.e("error","parameter classes is null);
or launch in debug add a break point on your return and look at the values of the parameters around the breakpoint.
return this.size();
I think.
精彩评论