I have this code inside the onMapReady that sets up the lat/long along with starting the async task of prepping the overlay image.
public void onMapReady(GoogleMap googleMap) {
mGoogleMap = googleMap;
moveToCurrentLocation(mGoogleMap,new LatLng(49.26874005, -123.19854477));
newarkBounds= new LatLngBounds(
new LatLng(49.26874005, -123.19854477), // South west corner
new LatLng(49.27462099, -123.19069126)); // North east corner*//*
// Adds a ground overlay with 50% transparency.
new BitmapWorkerTask().execute();
}
here is the code prepping the image and setting it to google maps.
class BitmapWorkerTask extends AsyncTask<Integer, Void, Bitmap> {
private int data = 0;
public BitmapWorkerTask() {
// Use a WeakReference to ensure the ImageView can be garbage collected
}
// Decode image in background.
@Override
protected Bitmap doInBackground(Integer... params) {
imageDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.vfmf_overlay);
return null;
}
// Once complete, see if ImageView is still around and set bitmap.
@Override
protected void onPostExecute(Bitmap bitmap) {
mGoogleMap.addGroundOverlay(new GroundOverlayOptions()
.image(imageDescriptor)
.positionFromBounds(newarkBounds));
}
}
my current image is 63KB and when I zoom in to the max, I'm able to see the image file, which is .png, perfectly clear, but when it's zoomed out it looks like a shredded piece of paper and pieces of it are missing. However, when I use the same image when it's 332 KB, the application crashes with out of memory. Using this very same code. Any idea why this is happening?