I guess I found a simple solution:
Implementing a subclass of android.app.Application and reacting
on public void onTrimMemory (int level). From the documentation:
"Called when the operating system has determined that it
is a good time for a process to trim unneeded memory
from its process. This will happen for example when it
goes in the background and there is not enough memory
to keep as many background processes running as desired."
I guess the level public static final int TRIM_MEMORY_COMPLETE
is the best for my purpose. From the documentation:
Level for onTrimMemory(int): the process is nearing the end
of the background LRU list, and if more memory isn't found soon
it will be killed. Constant Value: 80 (0x00000050)
Unfortunately only level 14, so that I cannot use it on Android 2.3.
Or is there some compatibility lib?
On 20 Jan., 01:50, Jan Burse <[email protected]> wrote:
> Mark Murphy schrieb:
>
> > You are missing the point. If I am understanding the documentation for
> > MemoryPoolMXBean, there cannot be "some other lib". I believe that you
> > will be needing to remove the ties to javax.management, not replace
> > them.
>
> Since I only need the memory threshold functionality
> I could easily implement the functionality in Android
> by myself by polling Runtime.freeMemory() in a thread.
> The later is available in Android.
>
> But it would be more handy if there is some existing
> lib or even an API in Android that I did not yet see.
>
> Bye
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en