Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 73: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 74: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 75: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 76: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 77: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 78: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
package org.anddev.android.pizzatimer; import android.app.Activity; import android.app.NotificationManager; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.KeyEvent; import android.view.Menu; import android.view.Menu.Item; public class PizzaTimer extends Activity { protected static final int DEFAULTSECONDS = 60 * 12; // 12 MInutes /* The value of these IDs is random! * they are just needed to be recognized */ protected static final int SECONDPASSEDIDENTIFIER = 0x1337; protected static final int GUIUPDATEIDENTIFIER = 0x101; protected static final int PIZZA_NOTIFICATION_ID = 0x1991; /** is the countdown running at the moment ?*/ protected boolean running = false; /** Seconds passed so far */ protected int mySecondsPassed = 0; /** Seconds to be passed totally */ protected int mySecondsTotal = DEFAULTSECONDS; /* Thread that sends a message * to the handler every second */ Thread myRefreshThread = null; // One View is all that we see. PizzaView myPizzaView = null; /* The Handler that receives the messages * sent out by myRefreshThread every second */ Handler myPizzaViewUpdateHandler = new Handler(){ /** Gets called on every message that is received */ // @Override public void handleMessage(Message msg) { switch (msg.what) { case PizzaTimer.SECONDPASSEDIDENTIFIER: // We identified the Message by its What-ID if (running) { // One second has passed mySecondsPassed++; if(mySecondsPassed == mySecondsTotal){ // Time is finished, lets display a notification! // Get the notification manager serivce. NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); /* The id we use here happens to be the * id of the text we display. You can use * any int here that is unique within * your application. */ nm.notifyWithText(PIZZA_NOTIFICATION_ID, getText(R.string.pizza_notification_text), NotificationManager.LENGTH_LONG, null); } } // No break here --> runs into the next case case PizzaTimer.GUIUPDATEIDENTIFIER: // Redraw our Pizza !! myPizzaView.updateSecondsPassed(mySecondsPassed); myPizzaView.updateSecondsTotal(mySecondsTotal); myPizzaView.invalidate(); break; } super.handleMessage(msg); } }; /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); this.myPizzaView = new PizzaView(this); this.myPizzaView.updateSecondsTotal(PizzaTimer.DEFAULTSECONDS); setContentView(this.myPizzaView); this.myRefreshThread = new Thread(new secondCountDownRunner()); this.myRefreshThread.start(); } @Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(0,0,getResources().getString(R.string.menu_reset)); return super.onCreateOptionsMenu(menu); } @Override public boolean onMenuItemSelected(int featureId, Item item) { switch(item.getId()){ case 0: // Reset the counter and stop it this.mySecondsTotal = PizzaTimer.DEFAULTSECONDS; this.mySecondsPassed = 0; this.running = false; return true; } return super.onMenuItemSelected(featureId, item); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { Message m = new Message(); m.what = PizzaTimer.GUIUPDATEIDENTIFIER; switch(keyCode){ case KeyEvent.KEYCODE_DPAD_UP: this.mySecondsTotal += 60; // One minute later break; case KeyEvent.KEYCODE_DPAD_DOWN: this.mySecondsTotal -= 60; // One minute earlier break; case KeyEvent.KEYCODE_DPAD_CENTER: this.running = !this.running; // START / PAUSE break; case KeyEvent.KEYCODE_DPAD_LEFT: this.mySecondsTotal += 1; // One second later break; case KeyEvent.KEYCODE_DPAD_RIGHT: this.mySecondsTotal -= 1; // One second earlier break; default: return super.onKeyDown(keyCode, event); } this.myPizzaViewUpdateHandler.sendMessage(m); return true; } class secondCountDownRunner implements Runnable{ // @Override public void run() { while(!Thread.currentThread().isInterrupted()){ Message m = new Message(); m.what = PizzaTimer.SECONDPASSEDIDENTIFIER; PizzaTimer.this.myPizzaViewUpdateHandler.sendMessage(m); try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } } }