/* Creates the menu items */
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, MENU_SECS, 0, "Seconds").setIcon(R.drawable.android_icon_seconds);
menu.add(0, MENU_TEXT, 0, "Calculations").setIcon(R.drawable.android_icon_calculations);
menu.add(0, MENU_INFO, 0, "About").setIcon(android.R.drawable.ic_menu_info_details);
return true;
}
/* Handles item selections */
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_SECS:
ToggleSecondsDisplay();
return true;
case MENU_TEXT:
ToggleText();
return true;
case MENU_INFO:
AboutDialog();
return true;
}
return false;
}
RepeatTimer SecondTimer;
SecondTimer = new RepeatTimer(1000,200);
SecondTimer.start();
public class RepeatTimer extends CountDownTimer {
public RepeatTimer(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
@Override
public void onFinish() {
this.start();
}
@Override
public void onTick(long millisUntilFinished) {
Time time = new Time();
time.setToNow();
UpdateLEDS(LLSeconds,DecToBin( time.second,6));
if (LLTextForm.getVisibility()==View.VISIBLE) {
TVSeconds.setText(DecToCalcString( time.second,6));
}
}
}
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_TIME_TICK);
getBaseContext().registerReceiver(mIntentReceiver, filter, null, mHandler);
/*
* Event handler, time_tick etc
* replicated from AnalogClock.java
*/
private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
onTimeChanged();
};
email
root
flog archives
In fact I'm not responsible for anything ever, so there!
Disclaimer:
This page is by me for me, if you are not me then please be aware of the following
I am not responsible for anything that works or does not work including files and pages made available at www.jumpstation.co.uk
I am also not responsible for any information(or what you or others do with it) available at www.jumpstation.co.uk