aspose file tools*
The moose likes Android and the fly likes Using WeakReferences in Android Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Using WeakReferences in Android" Watch "Using WeakReferences in Android" New topic
Author

Using WeakReferences in Android

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

I understand that WeakReferences are especially suited to implement Caches.

Are there other scenarios whereby WeakReferences are suitable on a mobile platform like Android ?
I understand that Android reclaims memory itself by killing processes.
Leandro Coutinho
Ranch Hand

Joined: Mar 04, 2009
Posts: 417
Weak references are used to prevent circular references too.
Ed Burnette
Author
Ranch Hand

Joined: Jun 10, 2003
Posts: 142
Android's Dalvik VM does garbage collection just like your desktop version of Java SE does.

In addition to that, when memory gets tight, paused applications can be killed. If they're needed later they are reconstituted from saved state.


Ed Burnette, Author of Hello Android
Blog: ZDNet's Dev Connection - Twitter: @eburnette
 
 
subject: Using WeakReferences in Android