07 Oct 2009, 23:08
Generic-user-small

Win Myo Htet (31 posts)

There are two methods in View for drawing. One is onDraw(Canvas canvas) and the other is draw(Canvas canvas). onDraw() is being called by the system and draw() is for manual drawing. How can I use draw(Canvas canvas)? How can I get canvas? Do I create Canvas canvas=new Canvas()?

08 Oct 2009, 22:21
Burnette_ed_pragsmall

Ed Burnette (1316 posts)

You should not call or implement the draw() function. If you look at the source code (http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/java/android/view/View.java;hb=refs/heads/donut-release) you’ll see that the draw() method does a few things like drawing the background and handling fade, then calls your onDraw() function. All your real drawing calls should be in your onDraw() function.

  You must be logged in to comment