Thursday, March 1, 2012

NullPointerException - What to do?


I'm experiencing a NullpointerException with this code:




kuglebutton.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {

if(toggle.isChecked())
{
counter1 = counter1 + 10;
column1tv.setText("" + counter1);
}
else
{
counter1 = counter1 - 2;
column1tv.setText("" + counter1);
}
}
});



Can anyone tell me what i'm doing wrong, and maybe how to fix it?

1 comment:

  1. As blackbelt said, something is null. Use logcat to see exactly where you get the exception. When you found the place, the problem is sometimes obvious.

    ReplyDelete