首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >java.lang.OutOfMemoryError:在执行Android可扩展列表时,位图大小超过VM预算

java.lang.OutOfMemoryError:在执行Android可扩展列表时,位图大小超过VM预算
EN

Stack Overflow用户
提问于 2011-07-27 12:46:46
回答 3查看 1.3K关注 0票数 0

基于活动中的字符串,iam执行可扩展列表(从原始文件夹(data.txt)检索所有子内容),但是在设置适配器时出现了问题

代码语言:javascript
复制
   public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);


              String s11="friendly-lovable";


            temp=s11.split(delimeter);  
            for(i =0; i < temp.length ; i++)
                System.out.println(temp[0]);
            System.out.println(temp[1]);
            System.out.println(temp.length);


                DataGetting();//this method for adding items to expandable List.it is running successfully
            DataGetting1();//calling all values from  raw data.txt file for first word temp[0] .it is also executing successfully 
            childAdding();//calling all values from  raw data.txt file for first word temp[1] .it is also executing successfully 

      elasricadapter=new MyExpandableListAdapter();
      //up to this executing successfully .


      setListAdapter(elasricadapter); //from this line am getting error in log cat .

错误是:

代码语言:javascript
复制
ERROR/dalvikvm-heap(598): 355200-byte external allocation too large for this process.
 ERROR/GraphicsJNI(598): VM won't let us allocate 355200 bytes 
 ERROR/AndroidRuntime(598): FATAL EXCEPTION: main
 ERROR/AndroidRuntime(598): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.gini/com.gini.Mainactivity}: android.view.InflateException: Binary XML file line #20: Error inflating class android.widget.ExpandableListView
ERROR/AndroidRuntime(598): Caused by: android.view.InflateException: Binary XML file line #20: Error inflating class android.widget.ExpandableListView
: ERROR/AndroidRuntime(598): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
ERROR/AndroidRuntime(598):     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
 ERROR/AndroidRuntime(598):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:450)
 ERROR/AndroidRuntime(598):     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:326)

所以请帮助我

拉吉尼卡

EN

回答 3

Stack Overflow用户

发布于 2011-07-27 13:01:35

您还应该尝试直接在实际设备上测试应用程序(使用模拟器提供的所有调试工具),因为内存不足异常可能不会出现。我的一个应用程序就是这样。但是,这并不意味着它永远不会发生。

票数 1
EN

Stack Overflow用户

发布于 2011-07-27 12:49:47

该阶段正在处理位图。这张照片实在太大了。除了使用较小的图像之外,没有其他解决办法。

票数 0
EN

Stack Overflow用户

发布于 2011-07-27 12:51:31

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6844517

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档