App crashes when mutiple (large) images are loaded.

edited May 2016 in Android Mode

Hi. I'm designing an android app for my university project. It's a car racing game. I'm using a image of resolution 8000x8000 as racing track. Now I'm trying to add another image as startup image. But after loading this image it crashes everytime when I open the app. The problem is I guess my smartphone's RAM can't handle that amoun of data. How can I overcome this problem? It's almost deadline and it's driving me crazy. :(

Tagged:

Answers

  • I had a similar problem loading multiple images before. I don't know much about memory ram limitations, meaning I am not sure how to calculate the available memory taken in a process. However downsizing my images did the trick, at least for my project requirement and the image quality wasn't noticeably affected.

    I hope this helps,

    Kf

  • Answer ✓

    @Tahsin=== I dont think that it is possible to do so; but your 8000 image can be divided in a lot of images, like tiles in a map, that you can call when it is necessary (eg when the user scrolls); i have done that and finally seen that 9 "little" images only are necessary.

  • @akenaton===You mean I have to divide my image into a lot other images? Do I have to do this manually(using photoshop or MS paint) or is there any function available in Processing to do so?

  • edited May 2016 Answer ✓

    @Tashin===

    photoshop of course because if you create a function for that you have to load the big image before calling it!

  • If your slices are going to be 8000x8000 in total that's going to be more memory than using a single image... However if there are repeated areas of the main image then you can use tiles.

    http://opengameart.org/content/race-track-tiles-0

    For instance...

  • @koogs=== yes, in total (in the app package or on the sd card) it will be probably a little more; yet, at runtime, if you load only 9 tiles among all it is not at all the same...

  • I have an idea. I'm using a PImage variable and each time I need to use an image, I'm going to make that image variable=null and then load the required image. Thus I can avoid loading two images at a time.

    I've already given it a try. The thing is sometimes it works and sometime it doesn't.

Sign In or Register to comment.