In a View class, I override onFinishInflate()
to invoke setupEventHandlers()
which defines some listeners. For example:
setDate.setOnClickListener( new OnSingleClick() {
@Override
public void onSingleClick( final View v ) {
controller.onSetDate();
}
}
} );
In controller.onSetDate()
I have the command:
SystemClock.setCurrentTimeMillis(dateTime.getMillis());
(dateTime
is a DateTime
Object)
After this method is called, the system kind of freezes. The listeners stop working. Nothing happens when I click the attached buttons (also checked in debug mode - it doesn't enter the listener when a button is clicked). Only pressing back (on the android device itself) works, and then the system returns to normal again (it recognizes the listeners).
Why is this happening?
EDIT:
I'm working on a rooted device, and all the permissions are set.
Now my code looks like this:
AlarmManager alarm = (AlarmManager) MainApplication.getAppContext().getSystemService( Context.ALARM_SERVICE );
long time = dateTime.getMillis();
DateTimeZone zone = dateTime.getZone();
alarm.setTime( time );
alarm.setTimeZone( zone.toTimeZone().getID() );
TimeZone.setDefault( zone.toTimeZone() );
DateTimeZone.setDefault( zone );
The problem occurs only when I try to set the time/date backwards. Setting it forward works fine.
"chmod 666 /dev/alarm"
before callingSystemClock.setCurrentTimeMillis()
– Alaa M.