onDraw Questions

Problems with Canvas, OpenGL, etc...

onDraw Questions

Postby engineer » Mon Dec 06, 2010 9:22 am

Hi, i have been trying to understand exactly how the onDraw method works. Does it have some sort of listener, or is it only called when the programmer calls it?

I am drawing different objects with my program. I put all the paths in an array, and at the end of the onDraw method, i clear the array. This does not work properly.

Also, right now, the only way i know to clear the screen is to repaint the background. Does my program take a performace hit due to the fact that my original drawings are still there (just painted over) or does it not matter at all?

thank you
Once Poster
Once Poster
Posts: 1
Joined: Sun Dec 05, 2010 6:19 am


Re: onDraw Questions

Postby AedonEtLIRA » Mon Dec 06, 2010 9:55 pm

onDraw is called when ever the parent view is redrawn or the the view itself is invalidated.

http://developer.android.com/reference/ ... /View.html

I will have to see your onDraw method to see whats going on there.
As for the last part, kind of. It can hinder your performance based on how and what you are rendering. Again, I might be able to help more if I can see your onDraw.

Walk with purpose, and build something.
User avatar
Senior Developer
Senior Developer
Posts: 146
Joined: Wed Jul 28, 2010 11:52 pm


Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 1 guest