繁体   English   中英

Android中的Java.lang.OutOfMemoryError

[英]Java.lang.OutOfMemoryError in Android

现在,我正在尝试编写一个andorid应用程序。 并看到以下错误:

http://k1310.hizliresim.com/1g/l/tpvwu.png

这是主要代码:

package com.hayat.goz;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class Teste_Basla_1 extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.teste_basla_1);
         setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        final Button teste_basla = (Button)findViewById(R.id.button1);

         teste_basla .setOnClickListener(new View.OnClickListener() {

                public void onClick(View v) {

                    Intent a = new Intent(Teste_Basla_1.this, Gorme_testi_1.class);

                    startActivity(a);

                    finish();

                }});        

    }

    @Override  
    public void onBackPressed() {

           Intent a = new Intent(Teste_Basla_1.this, MainActivity.class);

            startActivity(a);

               finish();

    }    




}

这是XML代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:background="@drawable/uyarii">

    <Button
        android:id="@+id/button1"
        android:layout_width="90dp"
        android:layout_height="90dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="54dp"
        android:background="@drawable/testebaslaacilis"/>

</RelativeLayout>

我认为应用程序中的图像不够小,无法解析。 我无法使用PhotoShop缩小比例。 我应该用编码解决这个问题,但是我不知道该怎么做。

你能给我一些想法吗? 谢谢你们...

如错误所述,位图大小对于设备堆大小而言太大。 看android如何指导

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM