how should i load a bitmap for an android game?

Posted by Heysus Escobar on Stack Overflow See other posts from Stack Overflow or by Heysus Escobar
Published on 2012-10-22T22:59:08Z Indexed on 2012/10/22 23:00 UTC
Read the original article Hit count: 178

Filed under:
|
|

i been working on a game with no bitmaps or anything, I'm using rectangles as objects and changing their color for their purpose like a red rectangles for player and gray rectangles for walls. My question is what is the right way to replace the rectangles with bitmaps/images?

I know to load Bitmaps you can just do this :

Bitmap randomBitmap = BitmapFactory.decodeResource(getResources(),
com.example.android4gametest.R.drawable.ic_launcher);

Should i load all my Bitmaps and pass them to their Classes or should i load the bitmap inside their class instead of passing it ? and how would i do that because i cannot use the BitmapFactory because i have no access to the getResources()! or should i load my bitmaps/images from my assets folder which i know i wont have the same "tools" you can say to mess with the bitmap.

© Stack Overflow or respective owner

Related posts about java

Related posts about android