Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Bitmap or BitmapDrawable? [closed]

Tags:

android

I have been programming an android game for some time and I wonder if there is a difference between a Bitmap and a BitmapDrawable.

Any answers should include any differences between the RAM, loading speed, etc.

like image 904
shizzle31 Avatar asked Jan 09 '23 04:01

shizzle31


1 Answers

Bitmap is faster to draw and usually good for background images. There is a significant change to FPS depending on if you draw a bitmap or drawable. Bitmaps are faster to move.Low usage of RAM

You can use Bitmap drawable if you need to do the things like scaling, moving and other kinds of manipulations of the image. Not as fast but there's no other option if you want to do any of those things just mentioned. There is a high usage of RAM in this case.

Side Note : A Drawable that wraps a bitmap and can be tiled, stretched, or aligned. You can create a Bitmap Drawable from a file path, an input stream, through XML inflation, or from a Bitmap object.

like image 71
Umer Waqas Avatar answered Jan 18 '23 20:01

Umer Waqas