Javatpoint Logo

91-9990449935

 0120-4256464

Android Simple Graphics Example

The android.graphics.Canvas can be used to draw graphics in android. It provides methods to draw oval, rectangle, picture, text, line etc.

The android.graphics.Paint class is used with canvas to draw objects. It holds the information of color and style.

In this example, we are going to display 2D graphics in android.

activity_main.xml

File: activity_main.xml

Activity class

File: MainActivity.java


Output:

android simple graphics example output 1
Next TopicAndroid Quiz