I'm trying to load & display 2 large images on an ImageView which is under a FrameLayout. But the app tends to crash. I'm able to load 1 image at a time but not 2. What I'm trying to do is basically display a map with clickable areas using this method: https://blahti.wordpress.com/2012/06/26/images-with-clickable-areas/
I will implement the zoom and pan options in later. But for now I would just like to open up my app without it crashing.
Thanks!
Images dimensions (For both the images): 6027 x 4520
Here's the code: The XML:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/mainmap"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/tc1"/>
<ImageView
android:id="@+id/ident"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/mask"
android:visibility="invisible" />
</FrameLayout>
The Class:
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;
public class MainMap extends Activity {
ImageView a_ident, map;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
a_ident = (ImageView) findViewById(R.id.ident);
map = (ImageView) findViewById(R.id.mainmap);
BitmapFactory.Options option = new BitmapFactory.Options();
option.inJustDecodeBounds = true;
BitmapFactory.decodeResource(getResources(), R.id.ident, option);
BitmapFactory.Options option1 = new BitmapFactory.Options();
option1.inJustDecodeBounds = true;
BitmapFactory.decodeResource(getResources(), R.id.mainmap, option1);
}
}