you could model this in an algorithmic fashion:
check memory
if memory is sufficient
fetch images
if low memory (after image fetch),
release previously fetched image(s)
check out the java.lang.Runtime class, it has exactly the functions
you're looking for (specifically totalMemory() for the device's total
memory, and freeMemory() for how much free memory is left)
Here it is on the android developer website:
http://developer.android.com/reference/java/lang/Runtime.html
On Mar 9, 1:06 am, Manish Garg <[email protected]> wrote:
> Hi All,
>
> I want to check low memory state in my application. In my application
> i am fetching some iamges from the server and displaying them in the
> gallery. I am fetching images in batch, not at single time. At the
> time of low memory, i want to release previously fetched image so that
> i can store newly fetched images.
>
> my approach is to find out available memory, compare it with the
> threshold memory. If both are equal then release previously fetched
> images. but size of the threshold is in MB, while i would require only
> 500kb to 1 MB for new images.
>
> Please give me some idea.
--
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