PDA

View Full Version : خطای out of memory در google map v2



Kurdia
دوشنبه 28 اردیبهشت 1394, 22:17 عصر
در نرم افزار از نقشه گوگل استفاده می کنم
اما بعضی مواقع خطای out of memory می ده

android:minSdkVersion="10"

از کد زیر در نمایش گوگل مپ استفاده می کنم :

private static final LatLng GOOGLE_MAP_POSITION = new LatLng(35.79359699999999,51.303689);
// private GoogleMap map;
private void loadGoogleMap() {
try {
GoogleMap map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id. map_bacone)).getMap();
if (map != null) {
Marker hamburg = map.addMarker(new MarkerOptions().position(GOOGLE_MAP_POSITION)
.title("Co. Name")
.snippet("Co.").icon(BitmapDescriptorFactory
.fromResource(R.drawable.app_icon)));


}
MapsInitializer.initialize(this);
// Move the camera instantly to target with a zoom of 15.
map.moveCamera(CameraUpdateFactory.newLatLngZoom(G OOGLE_MAP_POSITION, 50));
// Zoom in, animating the camera.
map.animateCamera(CameraUpdateFactory.zoomTo(17), 2000, null);
} catch (GooglePlayServicesNotAvailableException gpsInaE){
ExceptionHelpers.catchMessage(gpsInaE);


Toast toast = Toast.makeText(App.configs.context , App.configs.context.getString(R.string.MAP_ERROR) , Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, (int) (UIHelpers.height * 0.45));
toast.show();


ll_map_cu.setVisibility(View.GONE); // hide google map's parent layout
img_title_cu.setVisibility(View.VISIBLE); // show image view to show instead of google map
}
}

متن خطا هم به شکل زیر هست :

05-18 15:47:17.582 9915-10775/com.emaarIt.app.Bernoulli I/dalvikvm﹕ [ 05-18 15:47:17.592 9915:0x2a17 W/dalvikvm ] threadid=24: thread exiting with uncaught exception (group=0x2b542210)
05-18 15:47:17.602 9915-10775/com.emaarIt.app.Bernoulli E/AndroidRuntime﹕ FATAL EXCEPTION: GLThread 1267
java.lang.OutOfMemoryError
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:6 05)
at android.graphics.Bitmap.createBitmap(Bitmap.java:5 85)
at com.google.maps.api.android.lib6.gmm6.o.c.l.a(Unkn own Source)
at com.google.maps.api.android.lib6.gmm6.o.c.o.a(Unkn own Source)
at com.google.maps.api.android.lib6.gmm6.o.c.o.a(Unkn own Source)
at com.google.maps.api.android.lib6.gmm6.o.c.o.b(Unkn own Source)
at com.google.maps.api.android.lib6.gmm6.o.c.b.al.a(U nknown Source)
at com.google.maps.api.android.lib6.gmm6.o.c.b.at.a(U nknown Source)
at com.google.maps.api.android.lib6.gmm6.o.x.a(Unknow n Source)
at com.google.maps.api.android.lib6.gmm6.o.l.a(Unknow n Source)
at com.google.maps.api.android.lib6.gmm6.o.l.b(Unknow n Source)
at com.google.maps.api.android.lib6.gmm6.o.cq.k(Unkno wn Source) at com.google.maps.api.android.lib6.gmm6.o.cq.run(Unk nown Source)

توی گوگل هم سرچ کردم اما راهکار مناسبی تا حالا پیدا نکردم و به نتیجه نرسیدم