Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 659 Bytes

File metadata and controls

17 lines (14 loc) · 659 Bytes

Android-Paint

Drawing on touch

Initially I was trying to implement some functionality with which I could drow something touching the screen. Following code helped me i that case.

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        currentXCoordinate = event.getX();
        currentYCoordinate = event.getY();
        float radious  = (float) 30.0;
        
        canvas.drawCircle(currentXCoordinate, currentYCoordinate, radious, paint);
        LinearLayout l1 = (LinearLayout)findViewById(R.id.drawarea);
        l1.setBackgroundDrawable(new BitmapDrawable(myBitMap));
        return super.onTouchEvent(event);
    }