android - Out of Memory Exception - Google Map GroundOverLay -


i'm trying draw picture on google map. i'm using latest version of google play services , checked lot issue , couldn't find answer.

here's code:

    bitmapdescriptor image = bitmapdescriptorfactory.fromresource(r.drawable.drawing_bg);     latlngbounds drawingbounds = new latlngbounds(                                    new latlng(29.93530, 30.88324),                                     new latlng(29.93609, 30.88329))                                 .including(new latlng(29.93580, 30.88286))                                 .including(new latlng(29.93563, 30.88374))                                 .including( new latlng(29.93593, 30.88347))                                 .including(new latlng(29.93561, 30.88298))                                 .including(new latlng(29.93591, 30.88344))                                 .including(new latlng(29.93563, 30.88301));     groundoverlay groundoverlay = mmap.addgroundoverlay(new groundoverlayoptions()      .image(image)      .zindex(2)       .positionfrombounds(drawingbounds)      .transparency((float) 0.0));      final marker currentlocationmarker = mmap.addmarker(new markeroptions().position(new latlng(29.93530, 30.88324)).draggable(true));     mmap.animatecamera(cameraupdatefactory.newlatlngzoom(new latlng(29.935431502437588,30.88327579200268), 20)); 

from logcat:

    05-03 11:45:17.860: e/dalvikvm-heap(1115): out of memory on 67108880-byte allocation.     05-03 11:45:17.860: i/dalvikvm(1115): "glthread 8598" prio=5 tid=21 runnable     05-03 11:45:17.860: i/dalvikvm(1115):   | group="main" scount=0 dscount=0 obj=0x4284d580 self=0x5a559790     05-03 11:45:17.860: i/dalvikvm(1115):   | systid=1502 nice=1 sched=0/0 cgrp=apps handle=1596223616     05-03 11:45:17.860: i/dalvikvm(1115):   | schedstat=( 216011094 92043700 221 ) utm=19 stm=2 core=3     05-03 11:45:17.860: i/dalvikvm(1115):   @ android.graphics.bitmap.nativecreate(native method)     05-03 11:45:17.860: i/dalvikvm(1115):   @ android.graphics.bitmap.createbitmap(bitmap.java:640)     05-03 11:45:17.860: i/dalvikvm(1115):   @ android.graphics.bitmap.createbitmap(bitmap.java:620)     05-03 11:45:17.860: i/dalvikvm(1115):   @ maps.s.h.a((null):-1)     05-03 11:45:17.860: i/dalvikvm(1115):   @ maps.cr.a.a((null):-1)     05-03 11:45:17.860: i/dalvikvm(1115):   @ maps.cr.a.a((null):-1)     05-03 11:45:17.860: i/dalvikvm(1115):   @ maps.z.aa.b((null):-1)     05-03 11:45:17.860: i/dalvikvm(1115):   @ maps.z.aa.a((null):-1)     05-03 11:45:17.860: i/dalvikvm(1115):   @ maps.z.bi.a((null):-1)     05-03 11:45:17.860: i/dalvikvm(1115):   @ maps.af.v.a((null):-1)     05-03 11:45:17.860: i/dalvikvm(1115):   @ maps.af.v.a((null):-1)     05-03 11:45:17.860: i/dalvikvm(1115):   @ maps.af.v.a((null):-1)     05-03 11:45:17.860: i/dalvikvm(1115):   @ maps.p.q.m((null):-1)     05-03 11:45:17.860: i/dalvikvm(1115):   @ maps.p.q.run((null):-1)     05-03 11:45:17.875: w/dalvikvm(1115): threadid=21: thread exiting uncaught exception (group=0x412cc2a0)     05-03 11:45:17.880: e/androidruntime(1115): fatal exception: glthread 8598     05-03 11:45:17.880: e/androidruntime(1115): java.lang.outofmemoryerror     05-03 11:45:17.880: e/androidruntime(1115):     @ android.graphics.bitmap.nativecreate(native method)     05-03 11:45:17.880: e/androidruntime(1115):     @ android.graphics.bitmap.createbitmap(bitmap.java:640)     05-03 11:45:17.880: e/androidruntime(1115):     @         android.graphics.bitmap.createbitmap(bitmap.java:620)     05-03 11:45:17.880: e/androidruntime(1115):     @ maps.s.h.a(unknown source)     05-03 11:45:17.880: e/androidruntime(1115):     @ maps.cr.a.a(unknown source)     05-03 11:45:17.880: e/androidruntime(1115):     @ maps.cr.a.a(unknown source)     05-03 11:45:17.880: e/androidruntime(1115):     @ maps.z.aa.b(unknown source)     05-03 11:45:17.880: e/androidruntime(1115):     @ maps.z.aa.a(unknown source)     05-03 11:45:17.880: e/androidruntime(1115):     @ maps.z.bi.a(unknown source)     05-03 11:45:17.880: e/androidruntime(1115):     @ maps.af.v.a(unknown source)     05-03 11:45:17.880: e/androidruntime(1115):     @ maps.af.v.a(unknown source)     05-03 11:45:17.880: e/androidruntime(1115):     @ maps.af.v.a(unknown source)     05-03 11:45:17.880: e/androidruntime(1115):     @ maps.p.q.m(unknown source)     05-03 11:45:17.880: e/androidruntime(1115):     @ maps.p.q.run(unknown source)     05-03 11:45:29.395: w/surfaceview(1115): check surface infomation creating=false formatchanged=false sizechanged=false visible=false visiblechanged=true surfacechanged=true realsizechanged=false redrawneeded=false left=false top=false 

i appreciate help

you should not using images large. logcat suggests try allocate 67 mb, way of devices.

edit:

maybe try using tileoverlay instead of groundoverlay if want show images on large area (city, country) , not have pixelated when zoomed.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -