On Sun, Apr 10, 2011 at 1:07 AM, Brill Pappin <bpap...@sixgreen.com> wrote:

> But onCreate is called before onCreateView... which is where my confusion
> really stems from.
> The fact that I need to initialize my internal components in onCreateView
> means it has to happen after onCreate.
>

Well any initialization that involves your views needs to be done in
onCreateView() or later.  Just don't put that code in onCreate().


> Also, I'm not clear on whether i can access my internal components after
> calling inflater.inflate in onCreateView or not. Since I have to return the
> View created there, the parent activity doesn't have it yet, so i'm
> expecting a call to getActivity().findViewById to fail... unless just the
> act of inflating will make them available (black box magic code)?
>

Your fragment should never use getActivity().findViewById() to access its
internal components.  Jat call View.findViewById() on your own view
hierarchy.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to