I am an Android Newbie and I'm developing Go game application for android.
I'm having a problem with drawing single stone on my board.
Here is my onDraw() method.
public void onDraw(Canvas canvas) {
//drawing a board
//...
//...
canvas.drawBitmap(stone_image, stoneX - (stone_image.getWidth() / 2), stoneY
- (stone_image.getHeight() / 2),paint);
}
And I have an onTouch() method:
public boolean onTouchEvent(MotionEvent event) {
stoneX = (int) event.getX();
stoneY = (int) event.getY();
return true;
}
The point is, when I set background color in my class constuctor using this method:
setBackgroundColor(Color.WHITE);
Application can't draw a stone on the board after a touchEvent, but when I don't set a background color, application draws a stone perfectly.
P.S. Attributes stoneX,stoneY are correctly defined and initialized.