1

I am trying to draw an image from a file, a png file. I need to draw it as a bitmap on a canvas but i cant get the file into the bitmap object without getting an error, after trying for a lot of time i need some help.

example of what i tried:

    Resources res = getResources();
    Bitmap bitmap = BitmapFactory.decodeResource(res, R.drawable.myimage);  

thanks!

LamaTo
  • 540
  • 1
  • 8
  • 21
  • 2
    what error are you getting ? – Blackbelt May 08 '15 at 17:41
  • Ignore your error and try something different. (Or post the error and lets solve it) – Marcos Vasconcelos May 08 '15 at 17:43
  • You likely need to reduce the resolution of your image. I am assuming you are running out of memory because you are trying to load a high res image which creates a large memory load for your app. There are tons of questions on SO about it here is one from a quick Google search http://stackoverflow.com/questions/16765899/out-of-memory-error-with-bitmap – zgc7009 May 08 '15 at 17:58

0 Answers0