Hi, all i am making a arc whose size keep on changing as value is
changed in thread, but problem is, i am not able to run thread, no
error nothing.
here is my code

package com.Arcs;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;

public class ArcTest extends Activity
{
        SampleView sv;

        public void onCreate(Bundle savedInstanceState)
        {
        super.onCreate(savedInstanceState);
        sv=new SampleView(this);
        setContentView(sv);
    }



        class SampleView extends View implements Runnable
        {
                Paint paint;
                RectF oval;
                float f,j=360;
                boolean running=true;

                SampleView(Context arc)
                {
                        super(arc);
                        paint=new Paint();
                        paint.setColor(0x88FF0000);
                        Thread t=new Thread(this);
                        t.start();
                        t.setPriority(10);
                }

                protected void onDraw(Canvas canvas)
                {
                        System.out.println("in ondraw");
                        canvas.drawColor(Color.WHITE);
                        oval=new RectF(10,10,280,250);
                        canvas.drawArc(oval, f, j, true, paint);
                        canvas.drawText(""+j, 30, 300, paint);
//                      f++;
//                      if(f>360)
//                              f=0;
//                      j--;
//                      if(j<0)
//                              j=360;
                        invalidate();

                }

                public void run()
                {
                        try{
                                while(running)
                                {
                                        j--;
                                        if(j<0)
                                                j=360;
                                        invalidate();
                                        Thread.sleep(150);
                                        System.out.println("in thread");
                                }
                        }catch(Exception e){e.printStackTrace();}
                }

        }

}


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to