I am making a small game for android. It is working smoothly when its working on a white background but when i want to put a background image, its becoming slower and slower. First i tried to add it as a layout background image but it was very slow, the animations were happening frame by frame. And then i decided to draw the background image as a Bitmap on canvas, the result was a little faster than the previous one but still its nothing comparing to the white background.
I tried to scale the image many times, i did it with higher resolution, lower resolution, but the result didnt change, its still slower.
So i wanted to ask, is there a way to add a background image to an android app without losing the smoothness and speed of the application?
Thanks
P.S: I am trying my application on Sony Tablet S
its pretty late but if someone else have the same problem ; on the draw it may try to resize again, you can use no-dpi (drawable-nodpi / drawable-sw600dp-nodpi) folder to skip resizing which requires so much cpu and time.
also something else may cause this , which i assume you forget to recycle old your bitmaps.
Recently i had the same issue and no answer helped me.But after playing with codes so many hours i found an amazing solution.What you have to do is copy your background image to all the drawable folders (drawable-hdpi,drawable-xhdpi...etc.) and thats it. And also my background image is png with 590kb file size. Be careful with image size because higher the size is slower the app. Hope this help to someone. :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With