Android的 - 三星Galaxy S3图像加载 [英] Android - Samsung Galaxy S3 image loading

查看:98
本文介绍了Android的 - 三星Galaxy S3图像加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以正常使用罚款几乎所有的Andr​​oid设备的Andr​​oid应用程序。最近,我测试了三星Galaxy S3这个程序,并开始崩溃的我 - 它运行的内存每一个现在,然后随机

I have an android app that is working perfectly fine on almost all the Android devices. Recently, I tested this app on Samsung Galaxy S3 and it started crashing on me - it runs out of memory every now and then randomly.

当应用程序加载时,它加载启动图像和背景图像(大小约为100K)。当我从而应用程序加载删除这些图片,应用程序工作正常。但是,当我离开他们那里,它的应用程序加载后随机内存用完。我检查了资源目录和应用程序只有在图像的绘制对象的文件夹,而不是在任何提拉 - 华电国际或LDPI或MDPI文件夹。因此,在设备试图将这些图像转换为适合手机的分辨率和它使用的所有内存?我们是否有华电国际,LDPI和MDPI文件夹的标准图像尺寸?任何帮助将大大AP preciated。

When the app loads up, it loads a splash image and a background image (about 100k in size). When I remove these images from while the app is loading, the app works fine. But when I leave them there, it runs out of memory randomly after the app loads up. I checked the resource directory and the app only has images in the Drawable folder, not in any of the drawable-hdpi or ldpi or mdpi folders. So is the device trying to convert these images to fit the phone's resolution and it's using all the memory? Do we have standard image sizes for hdpi, ldpi and mdpi folders? Any help will be greatly appreciated.

推荐答案

我的应用程序失败的银河S3的原因是因为银河S3具有比我测试我的应用程序与任何其他手机更高的分辨率。因此,它分配给位图的记忆是高得多,导致应用程序崩溃,因为内存不足。为了解决这个问题,我简单的从的onDestroy方法视图中删除的位图,它解决了问题。

The reason my app failed on Galaxy S3 is because Galaxy S3 has a much higher resolution than any other phones I tested my app with. Hence the memory it allocated for the bitmaps was much higher and that caused the app to crash as it ran out of memory. To solve the issue, I simple removed the bitmaps from the view in the onDestroy method and it solved the issue.

这篇关于Android的 - 三星Galaxy S3图像加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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