[英]to much usage RAM for application
I would like to reduce memory consumption. 我想减少内存消耗。 My application is small and consumes between 20-45 mb of RAM.
我的应用程序很小,消耗20-45 mb的RAM。 The problem arises when I add a lot of new things and objects means that soon we get error out of bounds.
当我添加许多新事物和对象时,就会出现问题,这意味着我们很快就会越界出错。
I have got situation like that: 我有这样的情况:
How can i change and try to make smaller usage for ram. 我该如何更改并尝试使ram的使用量减少。 i think it is urgently now.
我认为现在迫在眉睫。 I need suggestions for profesional programers :) How can i free a memory for variables wich i dont need anymore, and how can i delete button,image button and other thinks from ram
我需要给专业程序员的建议:)我如何释放不再需要的变量的内存,以及如何从ram中删除按钮,图像按钮和其他想法
thanks for all suggestion, 感谢您的所有建议,
lp piki12 lp piki12
A good place to start with RAM reduction are bitmaps as they inherently use a lot of RAM. 减少RAM的一个好地方就是位图,因为它们固有地会占用大量RAM。 Instead of loading a full bitmap into memory, it is much more efficient to only load the bitmap at a resolution to match the screen.
与其将完整的位图加载到内存中,不如仅以与屏幕匹配的分辨率加载位图,效率更高。 I recommend you look at: https://github.com/nostra13/Android-Universal-Image-Loader which makes this very easy to do.
我建议您看一下: https : //github.com/nostra13/Android-Universal-Image-Loader ,它非常容易做到。
EDIT: As the question ends up to be using Canvas, this option is not available. 编辑:由于问题最终要使用Canvas,因此此选项不可用。 Instead you have to implement this: http://developer.android.com/training/displaying-bitmaps/load-bitmap.html .
相反,您必须实现此方法: http : //developer.android.com/training/displaying-bitmaps/load-bitmap.html 。 It's still not that difficult as the majority of the code is provided.
由于提供了大多数代码,所以它并不那么困难。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.