In my Android project I have imageButton , and after clicking on it , it must open new Activity with imageView , and in my new Activity I must see the ImageButton's image only in large type , my image size is 17mb , and I got out of memory error. But my code works for images with little size. Can somebody help to resize image or change some bitmap options or advice other way? I'm new in android , and sorry for bad English :)
Here is my new Activity's XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:id="@+id/LL11"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Here must be an image">
</TextView>
<ImageView
android:id="@+id/imageView1"
android:maxWidth="10px"
android:maxHeight="10px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/ic_action_search" />
</LinearLayout>
and the java code
package com.example.example;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.ImageView;
package com.example.example;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.ImageView;
public class ActivityTwo extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.custom_dialog);
Bundle extras = getIntent().getExtras();
String path = extras.getString("path");
if(null != path)
{
Uri myUri = Uri.parse(path);
super.onCreate(savedInstanceState);
ImageView img1 = (ImageView) findViewById(R.id.imageView1);
img1.setImageURI(myUri);
}
}
}