Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid OutOfMemory exception - Is there another approach for my needs?
    text
    copied!<p>My app is loading a large image (a house floorplan), then drawing touch-reactive objects (furniture, lamps etc.) on the image. I have a base image file included with my app but the objects come from coords in my database.</p> <p>I've successfully deployed the app in multiple iterations, but now I need to use larger base images and <code>BitmapFactory</code> is causing an <code>OutOfMemory</code> exception on many devices (both old and new devices; anything with &lt; 32MB heap seems to crash). I've read the 157 OOM questions on SO, but I'm afraid the <a href="http://developer.android.com/training/displaying-bitmaps/index.html" rel="nofollow">link</a> they all seem to point to won't help me since resolution / zooming is critical to the app's function. </p> <p>I've tried to test the device's available memory before loading, but the results are spotty at best (some devices like the galaxy S3 report plenty of heap but still crash). I've also tried decreasing resolution but the image became unusable when reduced to a safe size based on the above test. </p> <p>Is there another way to implement this design without ever using bitmaps? I need to:</p> <ul> <li>Load large base image</li> <li>Create clickable shapes on top of the base image, maintaining their position / scale relative to the base image</li> <li><em>BONUS</em>: in the iOS version of my app, I can do SVG-style text scaling so a long label on a small object will stay inside the object instead of running across the map(and will be invisible until the image is zoomed). Replicating this in android would make me a happy code monkey.</li> </ul> <p>I can post code if needed, but you've all seen it before (almost all of it came from SO).</p> <p>Thanks in advance for reading, and for any help you can give.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload