I have a game which does a whole lot of image-scaling (once every time you enter a level). The scaling is done with a simple call to Bitmap.createScaledBitmap(Bitmap). I realize that until the garbage collector comes, I effectively have two copies of these images, but I've tested it to death on several Android devices, and only recently got a Galaxy S3. You would have thought that if a game runs perfectly well on the Xoom2, the Galaxy Tab and the Galaxy S2, to say nothing of lower-end models like the Galaxy Y and Galaxy Ace, it would run even better on the Galaxy S3. Embarrassingly, it doesn't, and all-too-often I run out of memory. I think I've optimized my game about as far as I'm willing to (admittedly, some optimization was called for). I'd like to understand the problem. Does anyone know of any memory-management problems regarding the S3? Is the screen size-RAM ratio worse than on, say, the Galaxy Tab? Thanks in advance.
If you're are scalling imgs you should use .isSampleSize in the BitmapFactory.Options before makes the bpm.
Related
I've got a game, canvas based, hardware accelerated, on android.
The game is smooth and run at 40-50 fps on a galaxy note 1, galaxy S3.
I tested it today on a galaxy note 3... and it's quite slow... 20fps, graphics are slow and every mp3 sound play provokes a little freeze.
'pro' games with this galaxy note 3 don't have any problems.
I'm quite surprised that my game is slow with such a recent phone, but not with older ones... I probably do something wrong... any ideas ?
My Android App is very slow on the Galaxy S4. And for SLOW I mean, 10 - 20 times slower than it is on a Galaxy SII... the weird thing it's that it is fast enough on the S2, galaxy tab 10.1, galaxy note 10.1 and a bunch of other samsung devices; it is perceptibly slower on the S3, and VERY slower on the S4...
It's a big app that uses a lot of animations and loads a lot of images from the assets folder and scales them...
I know that what I wrote it's not very helpful... did somebody get the same issue on some app?
No experience with the specific Galaxy S4. But what you can do to find potential issues is to check the Show GPU overdraw setting in developer settings. It shows areas that are drawn multiple times, which is very slow.
Besides that, check the hierarchy viewer to see if your layout trees are too deep, StrictMode to see if you are blocking the UI thread, and lint to do static code analysis for general problems.
I've found the problem: I don't know why but it slows when it loads images from the assets folder... it works really smooth if I put all those images in the drawable folder. The problem, now, is that i can't do it because my app will download the images from the internet (it will download a zip and put the images in a folder of the application).
Will try something else...
EDIT:
I am now using picasso for android and it works really smooth... recommended!!!
So I recently created a game with several activities. On my HTC Thunderbolt, all parts of the game seem to be running very fast; however, on my Galaxy 10.1, two of my five activities are running extremely slow (i.e. screen fading is slow, enemies and cursor are moving slow as well). I don't know what is wrong. The other activities are running at or at least near the speed my thunderbolt was running at. Can someone please help me?
Try enabling hardware accelerated graphics, which is available on Android 3.0+.
Or, if you are serious about game performance, use OpenGL instead.
First to thank you all for your great help, I have finally published my game puzzle, both full and free version. Not sure how would I do it without Stackoverflow.
I also learned a lot by helping others.
The issue I am having is that when I start applications I have developed, on Samsung Galaxy Tab, animations are jerky at first 10 seconds or so, then they become smooth. This is not the case on HTC desire or Samsung Europe mobile.
It does not matter whether the animation is a frame by frame canvas drawing or built in android view animations.
I wonder if there is something I can do to prevent this slow down; is it something to do the way Galaxy Tab buffers when loading an application and optimising the resources? Or is this to do with the fact that it has a higher resolution screen… or both.
One way to deal with this could be to create some kind of animated intro in the same activity which would preload/optimise Galaxy Tab for the game.
EDIT after few months of development:
When testing an app on Galaxy Tab it starts slow and the animation is jerky, but if I restart the app and/or unplug the USB link, then it run fast as it should.
It's hard to say without seeing any of you're code. I couldn't say if it's a general problem with your code that only becomes apparent on slower devices, or if it is actually an issue with the Tab.
When testing my applications on the Galaxy Tab the general user interface is slower than on a Galaxy S (2.2), Nexus S or HTC Hero (2.1) but there are reasons for this:
Nexus S has a better GPU and Android version
Samsung have enabled some hardware-acceleration wizardry in their later Galaxy S builds
The resolution of the Galaxy Tab is higher
My main experience has been that the effect of the garbage collector (GC) is much more prominent on the Tab, therefore it could be something to do with your memory management -- are you creating objects in your onDraw method?
I recently released a game on the Android market. It seems to be working fine for most people, but everyone using a Samsung Galaxy S is reporting the same problem: The graphics for the game are not being drawn on screen (though they appear to be present, sound effects are still generated). The game uses a SurfaceView to draw the various elements from PNG graphics, and everything is scaled so that it will work on any resolution. I don't have a Galaxy S, so debugging is quite hard, can anyone who's had experience developing on a Galaxy S let me know if they found any particular quirks with the device?
try loading the files in a loading screen to memory first and only then play the game.
Samsung Galaxy S GT-I9000 has very slow internal sd card. It is probably due to errors in a file system. Make sure your application does I/O operations on internal sd card only when absoultely neccessary.
Check here for details:
SQLite is extremely slow in Samsung Galaxy GT-I9000