Paint paint = new Paint(); paint.setStrokeWidth(5); paint.setColor(Color.RED); canvas.drawLine(0, 0, canvas.getWidth(), canvas.getHeight(), paint);
Paint paint = new Paint(); paint.setTextSize(30); paint.setColor(Color.BLUE); canvas.drawText("Hello World", 50, 50, paint);
Paint paint = new Paint(); paint.setColor(Color.GREEN); canvas.drawRect(30, 30, 200, 200, paint);This code creates a new Paint object, sets its color, and draws a rectangle on the canvas. The android.graphics package library is included in the Android SDK and provides a variety of classes for working with graphics on Android devices.