怎样的android处理内存溢出异常 [英] android how to handle out of memory exception

查看:111
本文介绍了怎样的android处理内存溢出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI   在我的应用我有照片视频等,在图像的情况下,我做了缩放,但我得到了内存异常的,有时,我该如何处理内存溢出异常efficently。

HI in my application i have photos videos etc, in the case of image i done the scaling ,but i get out of memory exception in sometimes, how can i handle the out of memory exception efficently.

推荐答案

检查图像尺寸为试图加载它比之前的可用内存较小。这样的最有效的方式来处理OutOfMemoryException异常是体系结构以这样的方式应用程序,它从未试图加载大量数据到存储器中,以避免该异常。

Check that the image size is smaller than the available memory before attempting to load it. So the most efficient way to handle OutOfMemoryException is to architecture your application in such a way that it never attempts to load lots of data into memory in order to avoid the exception.

这篇关于怎样的android处理内存溢出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆