How to use canvas.drawBitmap()

Problems with Canvas, OpenGL, etc...

How to use canvas.drawBitmap()

Postby rjuy » Mon Nov 15, 2010 2:22 am


I'm currently having an error when running this code.

Code: Select all
   protected void onDraw(Canvas canvas) {
      Paint background = new Paint();
      Paint forCircle = new Paint();


      Bitmap mBitmap = BitmapFactory.decodeResource(getResources(),R.drawable.icon);
      canvas.drawBitmap(mBitmap, null, forCircle);

the main program is not attached in here, but the code above was triggered when I click draw button.

thanks a lot!

Experienced Developer
Experienced Developer
Posts: 52
Joined: Mon Oct 25, 2010 2:38 am


Re: How to use canvas.drawBitmap()

Postby Schermvlieger » Mon Nov 15, 2010 9:12 am

Hi rjuy,

You really need to take a look at logcat to see what is causing your error; Even if after looking at logcat you have no clue whay is causing the error, it will help us help you if you provide the logcat information in your posts.
Senior Developer
Senior Developer
Posts: 159
Joined: Fri Feb 26, 2010 1:37 pm


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

Who is online

Users browsing this forum: No registered users and 3 guests