public void onTimeChanged(TimePicker tp, int hour, int min){
tp.setOnTimeChangedListener(null);
Integer a = new Integer(5);
if(a == null){
Log.d("ff", "integer IS null");
} else {
Log.d("ff", "integer is NOT null");
}
if(tp == null){
Log.d("ff", "tp IS null");
} else {
Log.d("ff", "tp is NOT null");
}
tp.setCurrentMinute(a);
tp.setOnTimeChangedListener(this);
}
This is my TimePicker#OnTimeChangedListener. tp.setCurrentMinute(a) causes a NullPointerException. I’ve tried using an int and an Integer – neither works. tp is not null and a isn’t either.
Works just fine on emulator, but not on phone running 2.2.
From the documentation:
You are setting the listener to null, then when you invoke .setCurrentMinute(a) the TimePicker gives a NullPointerException while trying to notify a null listener