为什么我会永远不得使用BitmapFactory的inPurgeable选项? [英] Why would I ever NOT use BitmapFactory's inPurgeable option?

查看:342
本文介绍了为什么我会永远不得使用BitmapFactory的inPurgeable选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android的 BitmapFactory.Options.inPurgeable 各个地方,以此来避免安卓2.x及更早(安卓3.1 修复此)OutOfMemory异常。

Android's BitmapFactory.Options.inPurgeable has been recommended in various places as a way to avoid OutOfMemory exceptions in Android 2.x and earlier (Android 3.1 fixes this).

如果 inPurgeable 是如此之大,为什么我会永远不想使用它呢?该<一href="http://developer.android.com/intl/fr/reference/android/graphics/BitmapFactory.Options.html#inPurgeable">documentation似乎对什么该选项是做细节很轻:

If inPurgeable is so great, why would I ever NOT want to use it? The documentation seems very light on details about what this option is doing:

如果此项设置为true,则生成位图将分配其像素,使得他们可以在系统需要回收内存被清除。在这种情况下,当像素需要再次访问(如位图绘制,的getPixels()被调用),它们将被自动重新去codeD

If this is set to true, then the resulting bitmap will allocate its pixels such that they can be purged if the system needs to reclaim memory. In that instance, when the pixels need to be accessed again (e.g. the bitmap is drawn, getPixels() is called), they will be automatically re-decoded

似乎很大。有什么收获?

Seems great. What's the catch?

推荐答案

的<一个href="http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html#inPurgeable">documentation随后进行了更新,其中涉及你原来的问题更多的信息。

The documentation has subsequently been updated with additional information which addresses your original question.

摘要:使用此标志不再推荐

Summary: use of this flag is no longer recommended.

这篇关于为什么我会永远不得使用BitmapFactory的inPurgeable选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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