Graphics in Android Using OnDraw() Method and Paint Class -Simple Example

Posted on .
androidarena_graphics

Hello nerds! Today I am going to show you how to play with graphics in Android using OnDraw() and Paint Class . It is very simple to go through with it , I am going to provide you a simple tutorial on that but you can change and can do experiments according to your choice.

You can download the source code here and make experiments according to your need.

Download Code

Here in this project we don’t need any kind of xml layout file we can create it through Java file or we can say dynamically . Create your project with your desire name and see on my

MainActivity.java .

Here in this example we use Paint class and by using object of paint we can set anything like above i mention like setColor,setStyle and by using Canvas object we can draw drawcircle,rectangle etc.

 

OutPut –

output_graphics_androidarena

 

If you have any query feel free to ask anything 🙂

 

  • sanjay

    very helpful….

  • Arjun pal

    basic level ….want some more Brother …..waiting for the game development series 2D openGles 2