Hi, I've this code:
Java: (http://nopaste.me/4449 )
package com.patrick.games.whackgroundhog;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
public class Game extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new Ground(this));
}
class Ground extends View {
public Ground(Context context) {
super(context);
}
public void onDraw(Canvas canvas) {
canvas.drawColor(Color.BLACK);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
//TODO: draw the circle
}
return true;
}
}
}
And I want to draw a circle when the onTouchEvent is called but I
don't know how to get the canvas Sad
Can you help me?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---