Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 错误:字节外部分配对此进程太大_Android_Bitmap_Out Of Memory - Fatal编程技术网

Android 错误:字节外部分配对此进程太大

Android 错误:字节外部分配对此进程太大,android,bitmap,out-of-memory,Android,Bitmap,Out Of Memory,项目运行正常,但突然出现了这个错误。我甚至增加了记忆力,但没有帮助。有人能提出问题所在吗。可以做些什么来释放分配 09-28 15:26:55.998: ERROR/dalvikvm-heap(536): 1398784-byte external allocation too large for this process. 09-28 15:26:55.998: ERROR/GraphicsJNI(536): VM won't let us allocate 1398784 b

项目运行正常,但突然出现了这个错误。我甚至增加了记忆力,但没有帮助。有人能提出问题所在吗。可以做些什么来释放分配

09-28 15:26:55.998: ERROR/dalvikvm-heap(536): 1398784-byte external allocation too large for this process.
        09-28 15:26:55.998: ERROR/GraphicsJNI(536): VM won't let us allocate 1398784 bytes
        09-28 15:26:56.058: DEBUG/AndroidRuntime(536): Shutting down VM
        09-28 15:26:56.058: WARN/dalvikvm(536): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
        09-28 15:26:56.468: ERROR/AndroidRuntime(536): FATAL EXCEPTION: main
        09-28 15:26:56.468: ERROR/AndroidRuntime(536): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.helper/com.helper.TabMainActivity}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.helper/com.helper.Warehouse}: android.view.InflateException: Binary XML file line #22: Error inflating class <unknown>
        --------------
        09-28 15:26:56.468: ERROR/AndroidRuntime(536): Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class <unknown>
        09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at android.view.LayoutInflater.createView(LayoutInflater.java:513)
        09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
        09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
        09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
        09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at java.lang.reflect.Constructor.constructNative(Native Method)
    09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
    09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at android.view.LayoutInflater.createView(LayoutInflater.java:500)
    09-28 15:26:56.468: ERROR/AndroidRuntime(536):     ... 32 more
    09-28 15:26:56.468: ERROR/AndroidRuntime(536): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
    09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at android.graphics.Bitmap.nativeCreate(Native Method)
    09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
    09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
    09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
    09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
    09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
    09-28 15:26:56.468: ERROR/AndroidRuntime(536):     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
09-28 15:26:55.998:错误/dalvikvm堆(536):1398784字节外部分配对此进程太大。
09-28 15:26:55.998:ERROR/GraphicsJNI(536):VM不允许我们分配1398784字节
09-28 15:26:56.058:DEBUG/AndroidRuntime(536):关闭虚拟机
09-28 15:26:56.058:WARN/dalvikvm(536):threadid=1:线程以未捕获异常退出(组=0x4001d800)
09-28 15:26:56.468:错误/AndroidRuntime(536):致命异常:主
09-28 15:26:56.468:ERROR/AndroidRuntime(536):java.lang.RuntimeException:无法启动活动组件信息{com.helper/com.helper.TabMainActivity}:java.lang.RuntimeException:无法启动活动组件信息{com.helper/com.helper.Warehouse}:android.view.InflateException:二进制XML文件行#22:错误膨胀类
--------------
09-28 15:26:56.468:ERROR/AndroidRuntime(536):由以下原因引起:android.view.InflateException:二进制XML文件行#22:错误膨胀类
09-28 15:26:56.468:ERROR/AndroidRuntime(536):在android.view.LayoutInflater.createView(LayoutInflater.java:513)
09-28 15:26:56.468:ERROR/AndroidRuntime(536):位于com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
09-28 15:26:56.468:ERROR/AndroidRuntime(536):在android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
09-28 15:26:56.468:ERROR/AndroidRuntime(536):在android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
09-28 15:26:56.468:ERROR/AndroidRuntime(536):在android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
09-28 15:26:56.468:ERROR/AndroidRuntime(536):位于java.lang.reflect.Constructor.constructNative(本机方法)
09-28 15:26:56.468:ERROR/AndroidRuntime(536):位于java.lang.reflect.Constructor.newInstance(Constructor.java:446)
09-28 15:26:56.468:ERROR/AndroidRuntime(536):在android.view.LayoutInflater.createView(LayoutInflater.java:500)
09-28 15:26:56.468:错误/AndroidRuntime(536):。。。32多
09-28 15:26:56.468:错误/AndroidRuntime(536):原因:java.lang.OutOfMemory错误:位图大小超出VM预算
09-28 15:26:56.468:ERROR/AndroidRuntime(536):在android.graphics.Bitmap.nativeCreate(本机方法)上
09-28 15:26:56.468:ERROR/AndroidRuntime(536):在android.graphics.Bitmap.createBitmap(Bitmap.java:468)
09-28 15:26:56.468:ERROR/AndroidRuntime(536):在android.graphics.Bitmap.createBitmap(Bitmap.java:435)
09-28 15:26:56.468:ERROR/AndroidRuntime(536):在android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)上
09-28 15:26:56.468:ERROR/AndroidRuntime(536):在android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
09-28 15:26:56.468:ERROR/AndroidRuntime(536):在android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)上
09-28 15:26:56.468:ERROR/AndroidRuntime(536):在android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)上
MyXML.xml----如果我删除listview,它可以正常工作

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"          
    android:layout_height="fill_parent"
    android:orientation="horizontal"          
    android:layout_width="fill_parent">
    <LinearLayout android:layout_width="fill_parent" android:id="@+id/linearfullview" android:layout_height="400sp"
    android:background="@drawable/background_full_view" android:layout_alignParentTop="true"/> 

    <LinearLayout android:layout_width="wrap_content" android:layout_height="180sp"
    android:layout_alignParentBottom="true" android:layout_marginTop="20sp"> 


        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"                  
        android:layout_height="wrap_content"                  

        android:layout_width="wrap_content"                  
        android:paddingLeft="2dp"                  
        android:paddingRight="2dp"                  

        android:gravity="bottom"                 
        android:layout_marginTop="30dp">                    
        <ListView android:id="@android:id/list" android:layout_width="130dip" 
                        android:layout_height="wrap_content"
                        android:background="@drawable/splash_plate"
                        android:paddingTop="2sp" 
                        android:paddingBottom="2sp"/> 

    </LinearLayout>

        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"                  
        android:layout_height="wrap_content"                  

        android:layout_width="wrap_content"                  
        android:paddingLeft="2dp"                  
        android:paddingRight="2dp"                  
        android:paddingTop="4dp" 
        android:gravity="bottom"                 
        android:layout_marginTop="30dp"
        >   
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"                  
        android:layout_height="wrap_content"                  
         android:id="@+id/linearFirst"
         android:layout_alignParentLeft="true"                 
        android:layout_width="wrap_content"                  
        android:paddingLeft="2dp"                  
        android:paddingRight="2dp"                  
        android:paddingTop="4dp" 
        android:gravity="bottom"                 
        android:layout_marginTop="30dp"
        android:visibility="invisible">                    
        <com.tcs.mobility.widget.WheelView 
        android:id="@+id/firstWheel"           
        android:layout_height="wrap_content"                  
        android:layout_width="100dp"/>                            
    </LinearLayout> 
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"                  
        android:layout_height="wrap_content"                  
         android:id="@+id/linearSecond"                  
        android:layout_width="wrap_content"                  
        android:paddingLeft="2dp"                  
        android:paddingRight="2dp" 
        android:layout_alignParentRight="true"                  
        android:paddingTop="4dp" 
        android:gravity="bottom"                 
        android:layout_marginTop="30dp"
        android:visibility="invisible">                    
        <com.tcs.mobility.widget.WheelView 
        android:id="@+id/secondWheel"                  
        android:layout_height="wrap_content"                  
        android:layout_width="100dp"/>                            
    </LinearLayout>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"                  
        android:layout_height="wrap_content"                  
         android:id="@+id/linearThird"                 
        android:layout_width="wrap_content"                  
        android:paddingLeft="2dp"                  
        android:paddingRight="2dp"                  
        android:paddingTop="4dp" 
        android:gravity="bottom"                 
        android:layout_marginTop="30dp"
        android:layout_alignParentLeft="true"
        android:visibility="invisible">
        <com.tcs.mobility.widget.WheelView 
        android:id="@+id/thirdWheel"                  
        android:layout_height="wrap_content"                  
        android:layout_width="200dp"/>

    </LinearLayout> 
    </RelativeLayout>
           </LinearLayout>                  


</RelativeLayout> 

我的班级---

公共类仓库扩展ListActivity{
创建时的公共void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
System.out.println(“内部仓库”);
setContentView(R.layout.warehous);
linearLayoutFirst=(LinearLayout)findViewById(R.id.linearFirst);
linearlayoufirst.setVisibility(View.GONE);
linearLayoutSecond=(LinearLayout)findViewById(R.id.linearSecond);
linearLayoutSecond.setVisibility(View.GONE);
linearLayoutThird=(LinearLayout)findViewById(R.id.linearThird);
linearLayoutThird.setVisibility(View.GONE);
字符串[]名称=新字符串[]{“存货账龄”、“存货携带成本”、“存货周转数”};
//创建一个ArrayAdapter,它将实际生成上面的字符串
//显示在列表视图中
this.setListAdapter(新的ArrayAdapter(this,R.layout.warehouse_列表,名称));
}
受保护的void onListItemClick(列表视图l、视图v、整数位置、长id){
super.onListItemClick(左、右、位置、id);
//获取已单击的项目
对象o=this.getListAdapter().getItem(位置);
字符串关键字=o.toString();
DataCreater DataCreater=新的DataCreater();
firstArray=getConvertedArray(MainActivity.custArr);
dataCreater.closeAll();
secondArray=getConvertedArray(warehouseLocArr);
thirdArray=getConvertedArray(MainActivity.marketArr);
first=(WheelView)findViewById(R.id.firstWheel);
第二个=(车轮视图)findViewById(R.id.secondWheel);
第三个=(车轮视图)findViewById(R.id.thirdWheel);
custStr=激活车轮(第一个,第一个阵列);
locStr=激活车轮(第二个,第二个阵列);
marStr=激活轮(第三个,第三个);
}
}
公共字符串activateWheel(WheelView适配器,字符串[]arrayL)
{
System.out.println(“适配器”+适配器);
adapter.setAdapter(新的arraywheladapter(arrayL));
适配器。可设置可见项(7);
adapter.setCurrentItem(1);
str=adapter.currentText();
返回str;
}
公共字符串[]getConvertedArray(ArrayListaray)
{        
String[]strArray=新字符串[array.size()];

对于(inti=0;i)您在项目中做了什么,为什么会这样
public class Warehouse extends ListActivity{
        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        System.out.println("Inside Warehouse");
        setContentView(R.layout.warehous);


        linearLayoutFirst = (LinearLayout) findViewById(R.id.linearFirst);
        linearLayoutFirst.setVisibility(View.GONE);
        linearLayoutSecond = (LinearLayout) findViewById(R.id.linearSecond);
        linearLayoutSecond.setVisibility(View.GONE);
        linearLayoutThird = (LinearLayout) findViewById(R.id.linearThird);
        linearLayoutThird.setVisibility(View.GONE);

        String[] names = new String[] { "Inventory Ageing", "Inventory Carring Cost", "Inventory Turns"};
        // Create an ArrayAdapter, that will actually make the Strings above
        // appear in the ListView
        this.setListAdapter(new ArrayAdapter<String>(this,R.layout.warehouse_list,names)); 
    }
    protected void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);
        // Get the item that was clicked
        Object o = this.getListAdapter().getItem(position);
        String keyword = o.toString();
        DataCreater dataCreater = new DataCreater(); 
        firstArray=getConvertedArray(MainActivity.custArr);

        dataCreater.closeAll();
        secondArray=getConvertedArray(warehouseLocArr);
        thirdArray = getConvertedArray(MainActivity.marketArr);
        first = (WheelView) findViewById(R.id.firstWheel);
        second = (WheelView) findViewById(R.id.secondWheel);
        third = (WheelView) findViewById(R.id.thirdWheel);

        custStr = activateWheel(first,firstArray);
        locStr = activateWheel(second,secondArray);
        marStr = activateWheel(third, thirdArray);
        }
    }
    public String activateWheel(WheelView adapter,String[] arrayL)
    {
        System.out.println(" adapter"+adapter);
        adapter.setAdapter(new ArrayWheelAdapter<String>(arrayL));
        adapter.setVisibleItems(7);
        adapter.setCurrentItem(1);
        str = adapter.currentText();
        return str;      
    }
    public String[] getConvertedArray(ArrayList<String>array)
    {        
            String[] strArray = new String[array.size()];
            for(int i=0; i<array.size();i++)
            {
                strArray[i] = array.get(i);
            }
            return strArray;
    }
}