我想如果選中複選框啓用一個按鈕,但IAM越來越nullpointerexception
安卓:NullPointerException異常使
viewHolder.checkBox.setChecked(Constants.checkBoxState[position]);
final Button savebtn1 = (Button) view.findViewById(R.id.savebtn);
viewHolder.checkBox.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (((CheckBox) v).isChecked()) {
// Toast.makeText(activity, "checked" , Toast.LENGTH_SHORT).show();
Constants.checkBoxState[position] = true;
Constants.selectedContacts.add(listCont.get(position));
savebtn1.setEnabled(true);
} else {
Constants.checkBoxState[position] = false;
Constants.selectedContacts.remove(listCont.get(position));
}
}
});
任何想法按鈕時?
可以顯示堆棧跟蹤嗎? – belyjz