First,GC will not recycle the memory at once you called. Here are some advice from android developer website:

  1. Do not keep long-lived references to a context-activity (a reference to an activity should have the same life cycle as the activity itself)

  2. Try using the context-application instead of a context-activity

  3. Avoid non-static inner classes in an activity if you don't control their life cycle, use a static inner class and make a weak reference to the activity inside. The solution to this issue is to use a static inner class with a WeakReference to the outer class, as done in ViewRoot and its W inner class for instance

  4. A garbage collector is not an insurance against memory leaks

Second, try to use BitmapFactory.options when you do not very care the quality of the bitmap.

Third, use try catch to process the OutOfMemory exception in catch block.

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. android中常见的四种布局
  2. Android(安卓)Studio开发JNI - 第一个JNI
  3. 自己归纳 Android(安卓)四种布局简介
  4. 作业三——观察者模式在Android广播机制
  5. ListPreference之entries和entryValues
  6. ListPreference之entries和entryValues
  7. 安卓自动完成文本框(autoCompleteTextVie
  8. cocos2d-2.1rc0-x-2.1.3建android工程Hel
  9. 手把手搭建 android 开发环境||资源打包
  10. Android(安卓)Java层 Looper 机制