В моем Android-проекте у меня есть imageButton, и после нажатия на него он должен открыть новую активность с imageView, а в моей новой активности я должен видеть изображение ImageButton только крупным шрифтом, размер моего изображения 17 МБ, и мне не хватило памяти ошибка. Но мой код работает для изображений небольшого размера. Может ли кто-нибудь помочь изменить размер изображения или изменить некоторые параметры растрового изображения или посоветовать другой способ? Я новичок в Android, и извините за плохой английский :)
Вот мой новый XML Activity
<?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>
и java-код
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);
}
}
}