What are the benefits of Android way of "saving memory" - explicitly passing Context objects everywhere?
Posted
by
Sarge Borsch
on Programmers
See other posts from Programmers
or by Sarge Borsch
Published on 2014-02-12T13:19:34Z
Indexed on
2014/05/30
3:51 UTC
Read the original article
Hit count: 242
Turned out, this question is not easy to formulate for me, but let's try.
In Android, pretty much any UI object depends on a Context
, and has defined lifetime. It also can destroy and recreate UI objects and even whole application process at any time, and so on. This makes coding asynchronous operations correctly not straightforward. (and sometimes very cumbersome) But I never have seen a real explanation, why it's done that way? There are other OSes, including mobile OSes (iOS, for example), that don't do such things. So, what are the wins of Android way (Activities & Contexts)? Does that allow Android applications to use much less RAM, or maybe there are other benefits?
© Programmers or respective owner