You're creating a new Ball and a new Canvas, but they're not attached to
your UI in any way.


On Tue, Jun 9, 2009 at 8:24 AM, patpat <[email protected]> wrote:

>
> I am new and here is my code.. when i ran it ...there was nothing...i
> expected there should be a circle appear..
> can anyone tell me why??
>
>
> package game.balance;
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.view.ViewGroup.LayoutParams;
> import android.widget.LinearLayout;
>
>
>
> public class theGame extends Activity {
>    /** Called when the activity is first created. */
>    @Override
>    public void onCreate(Bundle savedInstanceState) {
>        super.onCreate(savedInstanceState);
>        LinearLayout mLinearLayout = new LinearLayout(this);
>        Ball mBall = new Ball(this,10,10,30);
>        setContentView(mLinearLayout);
>    }
> }
>
>
>
> package game.balance;
>
> import android.content.Context;
> import android.graphics.Canvas;
> import android.graphics.Paint;
> import android.view.View;
>
> public class Ball extends View{
>
>
>                public Ball(Context context,float x,float y,int r) {
>                super(context);
>                // TODO Auto-generated constructor stub
>                Paint mPaint = new Paint();
>                mPaint.setColor(0xFF0000);
>                Canvas mCanvas = new Canvas();
>                mCanvas.drawCircle(x,y,r,mPaint);
>
>                }
> }
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to