+
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ wifiman = (WifiManager)getSystemService(Context.WIFI_SERVICE);
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ //getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ //getWindow().clearFlags(WindowManager.LayoutParams.
+ // FLAG_FORCE_NOT_FULLSCREEN);
+ setContentView(R.layout.main);
+ res = getResources();
+ month = res.getStringArray(R.array.month);
+ wday = res.getStringArray(R.array.wday);
+ tvt = (TextView)findViewById(R.id.time);
+ tvd = (TextView)findViewById(R.id.date);
+ tvs = (TextView)findViewById(R.id.timestamp);
+ ut = new UpdateTarget[] {
+ new UpdateTarget((TextView)findViewById(R.id.location), 1),
+ new UpdateTarget((TextView)findViewById(R.id.phonecall), 2)
+ };
+ Log.w("WhereAmI", "created UI, about to start update task");
+ mHandler.post(updateClock);
+ mHandler.post(updateCal);
+ mHandler.post(updateInfo);
+ Log.w("WhereAmI", "created UI, update task created");
+ }
+
+ /** Called when put to background */
+ @Override
+ public void onPause()
+ {
+ super.onPause();
+ Log.w("WhereAmI", "calling finish");
+ this.finish();
+ }
+
+ /** Called when the activity is destroyed. */
+ @Override
+ public void onDestroy()
+ {
+ super.onDestroy();
+ Log.w("WhereAmI", "going down");
+ mHandler.removeCallbacks(updateClock);
+ mHandler.removeCallbacks(updateCal);
+ mHandler.removeCallbacks(updateInfo);
+ //unregisterReceiver(connChanged);
+ boolean wifion = wifiman.setWifiEnabled(false);
+ Log.w("WhereAmI", "disabling wifi result " + wifion);
+ }