Ошибка: внешнее распределение байтов слишком велико для этого процесса - PullRequest
0 голосов
/ 28 сентября 2011

Проект работал нормально, внезапно начал выдавать эту ошибку.Я даже увеличил память, но не помог.Кто-нибудь может подсказать в чем проблема.Что можно сделать, чтобы освободить ассигнования.

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)

MyXML.xml -------- если я удаляю просмотр списка, он отлично работает

<?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> 

Myclass ---

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;
    }
}
...