The Pizza Timer - Threading/Drawing on Canvas

Tutorials with advanced 'difficulty' and more Lines of Code.

Re: The Pizza Timer - Threading/Drawing on Canvas

Postby edreamz » Fri Sep 17, 2010 10:04 pm

I had modified the code for the 2.2 API's, it is working fine for. Attached is the code.

Revving,
eDreamZ

PizzaView.java
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. import android.content.Context;
  2. import android.graphics.Canvas;
  3. import android.graphics.Paint;
  4. import android.graphics.RectF;
  5. import android.graphics.Paint.Style;
  6. import android.view.View;
  7.  
  8.  
  9. public class PizzaView extends View{
  10.         // ===========================================================
  11.         // Fields
  12.         // ===========================================================
  13.  
  14.         protected final int ARCSTROKEWIDTH = 20;
  15.  
  16.         // Set startup-values
  17.         protected int mySecondsPassed = 0;
  18.         protected int mySecondsTotal = 0;
  19.  
  20.         // Our Painting-Device (Pen/Pencil/Brush/Whatever...)
  21.         protected final Paint myArcSecondPaint = new Paint();
  22.         protected final Paint myArcMinutePaint = new Paint();
  23.         protected final Paint myCountDownTextPaint = new Paint();
  24.         protected final Paint myPizzaTimeTextPaint = new Paint();
  25.  
  26.         // ===========================================================
  27.         // Constructors
  28.         // ===========================================================
  29.  
  30.         public PizzaView(Context context) {
  31.                 super(context);
  32.                 this.setBackgroundDrawable(getResources().getDrawable(R.drawable.pizza));
  33.  
  34.                 // Black text for the countdown
  35.                 this.myCountDownTextPaint.setARGB(150, 255, 0, 0);
  36.                 this.myCountDownTextPaint.setTextSize(150);
  37.                 this.myCountDownTextPaint.setFakeBoldText(true);
  38.  
  39.                 // Orange text for the IT PIZZA TIME
  40.                 this.myPizzaTimeTextPaint.setARGB(255, 255, 60, 10);
  41.                 this.myPizzaTimeTextPaint.setTextSize(110);
  42.                 this.myPizzaTimeTextPaint.setFakeBoldText(true);
  43.  
  44.                 // Our minute-arc-paint fill be a lookthrough-red.
  45.                 this.myArcMinutePaint.setARGB(150, 170, 0, 0);
  46.                 this.myArcMinutePaint.setAntiAlias(true);
  47.                 this.myArcMinutePaint.setStyle(Style.STROKE);
  48.                 this.myArcMinutePaint.setStrokeWidth(ARCSTROKEWIDTH);
  49.  
  50.                 // Our minute-arc-paint fill be a less lookthrough-orange.
  51.                 this.myArcSecondPaint.setARGB(200, 255, 130, 20);
  52.                 this.myArcSecondPaint.setAntiAlias(true);
  53.                 this.myArcSecondPaint.setStyle(Style.STROKE);
  54.                 this.myArcSecondPaint.setStrokeWidth(ARCSTROKEWIDTH / 3);
  55.         }
  56.  
  57.         // ===========================================================
  58.         // onXYZ(...) - Methods
  59.         // ===========================================================
  60.  
  61.         @Override
  62.         protected void onDraw(Canvas canvas) {
  63.                 /* Calculate the time left,
  64.                  * until our pizza is finished. */
  65.                 int secondsLeft = this.mySecondsTotal - this.mySecondsPassed;
  66.  
  67.                 // Check if pizza is already done
  68.                 if(secondsLeft <= 0){
  69.                         /* Draw the "! PIZZA !"-String
  70.                          *  to the middle of the screen */
  71.                         String itIsPizzaTime = getResources().getString(
  72.                                         R.string.pizza_countdown_end);
  73.                         this.myPizzaTimeTextPaint.setTextSize(50);
  74.  
  75.                         canvas.drawText(itIsPizzaTime,
  76.                                         10, (this.getHeight() / 2) + 30,
  77.                                         this.myPizzaTimeTextPaint);                    
  78.                 }else{
  79.                         // At least one second left
  80.                         float angleAmountMinutes = ((this.mySecondsPassed * 1.0f)
  81.                                         / this.mySecondsTotal)
  82.                                         * 360;
  83.                         float angleAmountSeconds = ((60 -secondsLeft % 60) * 1.0f)
  84.                         / 60
  85.                         * 360;
  86.  
  87.                         /* Calculate an Rectangle,
  88.                          * with some spacing to the edges */
  89.                         RectF arcRect = new RectF(ARCSTROKEWIDTH / 2,
  90.                                         ARCSTROKEWIDTH / 2,
  91.                                         this.getWidth() - ARCSTROKEWIDTH / 2,
  92.                                         this.getHeight() - ARCSTROKEWIDTH / 2);
  93.  
  94.                         // Draw the Minutes-Arc into that rectangle            
  95.                         canvas.drawArc(arcRect, -90, angleAmountMinutes, true,
  96.                                         this.myArcMinutePaint);
  97.  
  98.                         // Draw the Seconds-Arc into that rectangle    
  99.                         canvas.drawArc(arcRect, -90, angleAmountSeconds, true,
  100.                                         this.myArcSecondPaint);
  101.  
  102.                         String timeDisplayString;
  103.                         if(secondsLeft > 60) // Show minutes
  104.                                 timeDisplayString = "" + (secondsLeft / 60);
  105.                         else // Show seconds when less than a minute
  106.                                 timeDisplayString = "" + secondsLeft;
  107.  
  108.                         // Draw the remaining time.
  109.                         canvas.drawText(timeDisplayString,
  110.                                         this.getWidth() / 2 - (30 * timeDisplayString.length()),
  111.                                         this.getHeight()/ 2 + 30,
  112.                                         this.myCountDownTextPaint);
  113.                 }
  114.         }
  115.         // ===========================================================
  116.         // Getter & Setter
  117.         // ===========================================================
  118.  
  119.         public void updateSecondsPassed(int someSeconds){
  120.                 this.mySecondsPassed = someSeconds;
  121.         }
  122.  
  123.         public void updateSecondsTotal(int totalSeconds){
  124.                 this.mySecondsTotal = totalSeconds;
  125.         }
  126. }
Parsed in 0.047 seconds, using GeSHi 1.0.8.4


PizzaTimer.java
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  import android.app.Activity;
  2. import android.app.Notification;
  3. import android.app.NotificationManager;
  4. import android.app.PendingIntent;
  5. import android.content.Context;
  6. import android.content.Intent;
  7. import android.os.Bundle;
  8. import android.os.Handler;
  9. import android.os.Message;
  10. import android.view.KeyEvent;
  11. import android.view.Menu;
  12. import android.view.MenuItem;
  13.  
  14. public class PizzaTimer extends Activity {
  15.  
  16.         protected static final int DEFAULTSECONDS = 60 * 12;  // 12 MInutes
  17.         /* The value of these IDs is random!
  18.          * they are just needed to be recognized */
  19.         protected static final int SECONDPASSEDIDENTIFIER = 0x1337;
  20.         protected static final int GUIUPDATEIDENTIFIER = 0x101;
  21.         protected static final int PIZZA_NOTIFICATION_ID = 0x1991;
  22.         protected static final int NOTIFY_PIZZA = 0x101;
  23.  
  24.         /** is the countdown running at the moment ?*/
  25.         protected boolean running = false;
  26.         /** Seconds passed so far */
  27.         protected int mySecondsPassed = 0;
  28.         /** Seconds to be passed totally */
  29.         protected int mySecondsTotal = DEFAULTSECONDS;
  30.  
  31.         /* Thread that sends a message
  32.          * to the handler every second */
  33.         Thread myRefreshThread = null;
  34.         // One View is all that we see.
  35.         PizzaView myPizzaView = null;
  36.  
  37.         /* The Handler that receives the messages
  38.          * sent out by myRefreshThread every second */
  39.         Handler myPizzaViewUpdateHandler = new Handler(){
  40.                 /** Gets called on every message that is received */
  41.                 // @Override
  42.                 public void handleMessage(Message msg) {
  43.                         switch (msg.what) {
  44.                         case PizzaTimer.SECONDPASSEDIDENTIFIER:
  45.                                 // We identified the Message by its What-ID
  46.                                 if (running) {
  47.                                         // One second has passed
  48.                                         mySecondsPassed++;
  49.                                         if(mySecondsPassed == mySecondsTotal){
  50.                                                 // Time is finished, lets display a notification!
  51.                                                 // Get the notification manager service.
  52.                                                 NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
  53.  
  54.                                                 /* The id we use here happens to be the
  55.                                                  * id of the text we display. You can use
  56.                                                  * any int here that is unique within
  57.                                                  * your application. */
  58.                                                 int iconNot = R.drawable.icon;
  59.                                                 CharSequence ticker = getResources().getString(R.string.pizza_notification_text);
  60.                                                 Notification notifyme = new Notification(iconNot, ticker, System.currentTimeMillis());
  61.                                                 notifyme.defaults |= Notification.DEFAULT_SOUND;
  62.  
  63.                                                 Context context = getApplicationContext();
  64.                                                 CharSequence contentTitle = "Pizza Timer";
  65.                                                 CharSequence contentText = "Your Pizza is ready";
  66.                                                 Intent notIntent = new Intent(context,PizzaView.class);
  67.                                                 PendingIntent contentIntent = PendingIntent.getActivity(context,0, notIntent, 0);
  68.                                                 notifyme.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
  69.  
  70.                                                 nm.notify(NOTIFY_PIZZA, notifyme);
  71.                                         }
  72.                                 }
  73.                                 // No break here --> runs into the next case
  74.                         case PizzaTimer.GUIUPDATEIDENTIFIER:
  75.                                 // Redraw our Pizza !!
  76.                                 myPizzaView.updateSecondsPassed(mySecondsPassed);
  77.                                 myPizzaView.updateSecondsTotal(mySecondsTotal);
  78.                                 myPizzaView.invalidate();
  79.                                 break;
  80.                         }
  81.                         super.handleMessage(msg);
  82.                 }
  83.         };
  84.  
  85.         /** Called when the activity is first created. */
  86.         @Override
  87.         public void onCreate(Bundle icicle) {
  88.                 super.onCreate(icicle);
  89.  
  90.                 this.myPizzaView = new PizzaView(this);
  91.                 this.myPizzaView.updateSecondsTotal(PizzaTimer.DEFAULTSECONDS);
  92.                 setContentView(this.myPizzaView);
  93.  
  94.                 this.myRefreshThread = new Thread(new secondCountDownRunner());
  95.                 this.myRefreshThread.start();
  96.         }
  97.  
  98.         @Override
  99.         public boolean onCreateOptionsMenu(Menu menu) {
  100.                 menu.add(0,0,android.view.Menu.NONE,getResources().getString(R.string.menu_reset));
  101.                 return super.onCreateOptionsMenu(menu);
  102.         }
  103.  
  104.         @Override
  105.         public boolean onMenuItemSelected(int featureId, MenuItem item) {
  106.                 switch(item.getItemId()){
  107.                 case 0:
  108.                         // Reset the counter and stop it
  109.                         this.mySecondsTotal = PizzaTimer.DEFAULTSECONDS;
  110.                         this.mySecondsPassed = 0;
  111.                         this.running = false;
  112.                         return true;
  113.                 }
  114.                 return super.onMenuItemSelected(featureId, item);
  115.         }
  116.  
  117.         @Override
  118.         public boolean onKeyDown(int keyCode, KeyEvent event) {
  119.                 Message m = new Message();
  120.                 m.what = PizzaTimer.GUIUPDATEIDENTIFIER;
  121.  
  122.                 switch(keyCode){
  123.                 case KeyEvent.KEYCODE_DPAD_UP:
  124.                         this.mySecondsTotal += 60; // One minute later
  125.                         break;
  126.                 case KeyEvent.KEYCODE_DPAD_DOWN:
  127.                         this.mySecondsTotal -= 60; // One minute earlier
  128.                         break;
  129.                 case KeyEvent.KEYCODE_DPAD_CENTER:
  130.                         this.running = !this.running; // START / PAUSE
  131.                         break;
  132.                 case KeyEvent.KEYCODE_DPAD_LEFT:
  133.                         this.mySecondsTotal += 1; // One second later
  134.                         break;
  135.                 case KeyEvent.KEYCODE_DPAD_RIGHT:
  136.                         this.mySecondsTotal -= 1; // One second earlier
  137.                         break;
  138.                 default:
  139.                         return super.onKeyDown(keyCode, event);
  140.                 }
  141.  
  142.                 this.myPizzaViewUpdateHandler.sendMessage(m);
  143.                 return true;
  144.         }
  145.  
  146.         class secondCountDownRunner implements Runnable{
  147.                 // @Override
  148.                 public void run() {
  149.                         while(!Thread.currentThread().isInterrupted()){
  150.                                 Message m = new Message();
  151.                                 m.what = PizzaTimer.SECONDPASSEDIDENTIFIER;
  152.                                 PizzaTimer.this.myPizzaViewUpdateHandler.sendMessage(m);
  153.                                 try {
  154.                                         Thread.sleep(1000);
  155.                                 } catch (InterruptedException e) {
  156.                                         Thread.currentThread().interrupt();
  157.                                 }
  158.                         }
  159.                 }
  160.         }
  161. }
Parsed in 0.052 seconds, using GeSHi 1.0.8.4


strings.xml
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <resources>
  3.     <string name="hello">PizzaTimer!</string>
  4.     <string name="app_name">Pizza Timer</string>
  5.     <string name="pizza_countdown_end">Pizza Ready </string>
  6.     <string name="pizza_notification_text">Your Pizza is Ready</string>
  7.     <string name="menu_reset">Reset</string>
  8. </resources>
  9.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4
User avatar
edreamz
Junior Developer
Junior Developer
 
Posts: 18
Joined: Fri Aug 06, 2010 2:29 am
Location: U.S

Top

Re: The Pizza Timer - Threading/Drawing on Canvas

Postby unknown00 » Sun Nov 07, 2010 8:39 pm

tried the latest code for 2.2, doesn't work, just crashes on startup...
unknown00
Freshman
Freshman
 
Posts: 8
Joined: Mon Nov 01, 2010 3:11 am

Re: The Pizza Timer - Threading/Drawing on Canvas

Postby edreamz » Sun Nov 07, 2010 8:51 pm

unknown00 wrote:tried the latest code for 2.2, doesn't work, just crashes on startup...

What is the error your facing?
User avatar
edreamz
Junior Developer
Junior Developer
 
Posts: 18
Joined: Fri Aug 06, 2010 2:29 am
Location: U.S

Re: The Pizza Timer - Threading/Drawing on Canvas

Postby unknown00 » Sun Nov 07, 2010 9:10 pm

edreamz wrote:
unknown00 wrote:tried the latest code for 2.2, doesn't work, just crashes on startup...

What is the error your facing?

just the typical "application has stopped unexpectedly"
unknown00
Freshman
Freshman
 
Posts: 8
Joined: Mon Nov 01, 2010 3:11 am

Re: The Pizza Timer - Threading/Drawing on Canvas

Postby edreamz » Sun Nov 07, 2010 9:20 pm

unknown00 wrote:
edreamz wrote:
unknown00 wrote:tried the latest code for 2.2, doesn't work, just crashes on startup...

What is the error your facing?

just the typical "application has stopped unexpectedly"



Check LogCat for the error/exception you are facing.
User avatar
edreamz
Junior Developer
Junior Developer
 
Posts: 18
Joined: Fri Aug 06, 2010 2:29 am
Location: U.S

Re: The Pizza Timer - Threading/Drawing on Canvas

Postby unknown00 » Tue Nov 09, 2010 8:56 pm

Code: Select all
I/ActivityManager(   61): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=seniordesign.hell
oandroid/.HelloAndroid }
I/ActivityManager(   61): Start proc seniordesign.helloandroid for activity seni
ordesign.helloandroid/.HelloAndroid: pid=313 uid=10033 gids={1015}
D/dalvikvm(   33): GC_EXPLICIT freed 278 objects / 10512 bytes in 352ms
D/dalvikvm(   33): GC_EXPLICIT freed 52 objects / 2232 bytes in 233ms
D/AndroidRuntime(  313): Shutting down VM
W/dalvikvm(  313): threadid=1: thread exiting with uncaught exception (group=0x4
001d800)
D/dalvikvm(   33): GC_EXPLICIT freed 2 objects / 64 bytes in 500ms
E/AndroidRuntime(  313): FATAL EXCEPTION: main
E/AndroidRuntime(  313): java.lang.RuntimeException: Unable to instantiate activ
ity ComponentInfo{seniordesign.helloandroid/seniordesign.helloandroid.HelloAndro
id}: java.lang.ClassNotFoundException: seniordesign.helloandroid.HelloAndroid in
loader dalvik.system.PathClassLoader[/data/app/seniordesign.helloandroid-1.apk]

E/AndroidRuntime(  313):        at android.app.ActivityThread.performLaunchActiv
ity(ActivityThread.java:2585)
E/AndroidRuntime(  313):        at android.app.ActivityThread.handleLaunchActivi
ty(ActivityThread.java:2679)
E/AndroidRuntime(  313):        at android.app.ActivityThread.access$2300(Activi
tyThread.java:125)
E/AndroidRuntime(  313):        at android.app.ActivityThread$H.handleMessage(Ac
tivityThread.java:2033)
E/AndroidRuntime(  313):        at android.os.Handler.dispatchMessage(Handler.ja
va:99)
E/AndroidRuntime(  313):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  313):        at android.app.ActivityThread.main(ActivityThrea
d.java:4627)
E/AndroidRuntime(  313):        at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime(  313):        at java.lang.reflect.Method.invoke(Method.java:5
21)
E/AndroidRuntime(  313):        at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime(  313):        at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:626)
E/AndroidRuntime(  313):        at dalvik.system.NativeStart.main(Native Method)

E/AndroidRuntime(  313): Caused by: java.lang.ClassNotFoundException: seniordesi
gn.helloandroid.HelloAndroid in loader dalvik.system.PathClassLoader[/data/app/s
eniordesign.helloandroid-1.apk]
E/AndroidRuntime(  313):        at dalvik.system.PathClassLoader.findClass(PathC
lassLoader.java:243)
E/AndroidRuntime(  313):        at java.lang.ClassLoader.loadClass(ClassLoader.j
ava:573)
E/AndroidRuntime(  313):        at java.lang.ClassLoader.loadClass(ClassLoader.j
ava:532)
E/AndroidRuntime(  313):        at android.app.Instrumentation.newActivity(Instr
umentation.java:1021)
E/AndroidRuntime(  313):        at android.app.ActivityThread.performLaunchActiv
ity(ActivityThread.java:2577)
E/AndroidRuntime(  313):        ... 11 more
W/ActivityManager(   61):   Force finishing activity seniordesign.helloandroid/.
HelloAndroid
W/ActivityManager(   61): Activity pause timeout for HistoryRecord{43f683d8 seni
ordesign.helloandroid/.HelloAndroid}
unknown00
Freshman
Freshman
 
Posts: 8
Joined: Mon Nov 01, 2010 3:11 am

Top

Re: The Pizza Timer - Threading/Drawing on Canvas

Postby unknown00 » Sun Nov 14, 2010 4:25 pm

bump, any ideas?
unknown00
Freshman
Freshman
 
Posts: 8
Joined: Mon Nov 01, 2010 3:11 am

Re: The Pizza Timer - Threading/Drawing on Canvas

Postby edreamz » Sun Nov 14, 2010 4:40 pm

unknown00 wrote:bump, any ideas?


E/AndroidRuntime( 313): FATAL EXCEPTION: main
E/AndroidRuntime( 313): java.lang.RuntimeException: Unable to instantiate activ
ity ComponentInfo{seniordesign.helloandroid/seniordesign.helloandroid.HelloAndro
id}: java.lang.ClassNotFoundException: seniordesign.helloandroid.HelloAndroid in
loader dalvik.system.PathClassLoader[/data/app/seniordesign.helloandroid-1.apk]

Check for the missing class.
User avatar
edreamz
Junior Developer
Junior Developer
 
Posts: 18
Joined: Fri Aug 06, 2010 2:29 am
Location: U.S

Re: The Pizza Timer - Threading/Drawing on Canvas

Postby unknown00 » Mon Nov 15, 2010 4:09 am

still doesn't work, i re-created the project and everything and now it doesn't have an error, but when i cilck Run on emulator nothing happens. it doesn't install the app onto the simulator. just stays blank
unknown00
Freshman
Freshman
 
Posts: 8
Joined: Mon Nov 01, 2010 3:11 am

Re: The Pizza Timer - Threading/Drawing on Canvas

Postby edreamz » Mon Nov 15, 2010 4:26 am

unknown00 wrote:still doesn't work, i re-created the project and everything and now it doesn't have an error, but when i cilck Run on emulator nothing happens. it doesn't install the app onto the simulator. just stays blank


If everything(code) seems to be right, then close the emulator and start it again. :)
Else check the Manifest file.
User avatar
edreamz
Junior Developer
Junior Developer
 
Posts: 18
Joined: Fri Aug 06, 2010 2:29 am
Location: U.S

Re: The Pizza Timer - Threading/Drawing on Canvas

Postby unknown00 » Mon Nov 15, 2010 5:18 am

already tried restarting both the emulator, eclipse, and computer, nothing works

what is the manifest suppose to look like?

also, i tried copying the code into some other code i had that works, i got it to display the countdown, but it doesn't refresh nor countdown, it's just stuck

//EDIT: can you rar up your entire workspace/project and attach?
unknown00
Freshman
Freshman
 
Posts: 8
Joined: Mon Nov 01, 2010 3:11 am

Re: count dowtimer

Postby kishore.thorata » Wed Jul 20, 2011 7:07 am

Regards,
KISHORE.
User avatar
kishore.thorata
Freshman
Freshman
 
Posts: 8
Joined: Wed Jun 02, 2010 7:21 am

Re: The Pizza Timer - Threading/Drawing on Canvas

Postby lubomir » Fri Sep 30, 2011 4:54 pm

Be aware that every time you post sendmessage you create new Message object in loop. That couses in system ( cheked with DDMS ) that every time it goes to garbage collector and that is slowing done the drawing on realease. If you are reusing this code you can use postInvalidate directly in thread without message handler.
lubomir
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Sep 30, 2011 4:47 pm

Getting InstantiationException for PizzaTimer

Postby YuAndroid » Wed Nov 16, 2011 6:15 am

Hi there,
I installed your application and it ran smoothly for the first time with some modifications of my own. But when I just changed the names of java files to my project specifics, its giving InstantiationException whenever I tries to run it.

Following is my Android manifest file. Can you please guide me to resolve this issue as soon as possible?
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name="com.test.timer.PizzaView" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>

Here is the stack-trace for above error:
11-16 10:41:03.388: ERROR/AndroidRuntime(522): Uncaught handler: thread main exiting due to uncaught exception
11-16 10:41:03.433: ERROR/AndroidRuntime(522): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.test.timer/com.test.timer.PizzaView}: java.lang.InstantiationException: com.test.timer.PizzaView
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at android.os.Handler.dispatchMessage(Handler.java:99)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at android.os.Looper.loop(Looper.java:123)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at android.app.ActivityThread.main(ActivityThread.java:4363)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at java.lang.reflect.Method.invokeNative(Native Method)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at java.lang.reflect.Method.invoke(Method.java:521)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at dalvik.system.NativeStart.main(Native Method)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): Caused by: java.lang.InstantiationException: com.test.timer.PizzaView
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at java.lang.Class.newInstanceImpl(Native Method)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at java.lang.Class.newInstance(Class.java:1479)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-16 10:41:03.433: ERROR/AndroidRuntime(522): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)

Thanks in advance and waiting for your speedy reply :)
YuAndroid
Once Poster
Once Poster
 
Posts: 1
Joined: Wed Nov 16, 2011 6:00 am

Re: The Pizza Timer - Threading/Drawing on Canvas

Postby kunal » Fri Feb 17, 2012 7:36 am

The timer is not getting updated on the image.
Do we have any updated code for fixing this known issue?
kunal
Freshman
Freshman
 
Posts: 2
Joined: Thu Feb 16, 2012 12:25 pm

Top
Previous

Return to Advanced Tutorials

Who is online

Users browsing this forum: No registered users and 5 guests