On Fri, Jan 4, 2013 at 5:16 AM, Dmitriy F <[email protected]> wrote:
> Correct me if I'm wrong - onStop state destroys view hierarchy of
> activity/fragment.

First, nothing of this nature happens to the view hierarchy in
onStop(), or onDestroy() for that matter. You can tell this by looking
at the source code to Activity:

https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/app/Activity.java

Second, AFAIK there is no "destroy" semantics for views, except for
any drawing caches.

> Consequently, views that are referenced through the
> object fields will be retained because of hard references, for example if I
> have such a class:
>
> public class ArticleFragment extends Fragment {
>     WebView mWebView;
>
> The webview won't be destroyed.

That is because views are not destroyed.

If, by "destroyed", you mean "garbage collected", your WebView will be
eligible for garbage collection as soon as its containing Activity is.

Now, *static* data members are bigger issue.

> Am I right in my assumptions ?

No.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.5 Available!

-- 
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

Reply via email to