Committing a fragment transaction is asynchronous.  You should let it run
and do its thing; don't call getView() outside of the fragment's own
lifecycle.

Have you tried any of the API demos?  There are lots of them.  I suggest
starting off with one of those known working demos, found here:

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/index.html

On Sat, Jun 18, 2011 at 8:10 PM, New Developer <secur...@isscp.com> wrote:

> Here is what I have can you see something obvious
>
> in my MainActivity  I call the  Fragment using
>
> FragmentTransaction   fMgr  = getFragmentManager().beginTransaction();
> VisitMenu     fragment  = new VisitMenu();
> fMgr.add(R.id.menu2, fragment);
> fMgr.commit();
>
>
> fMgr.show(fragment);
>
>
> Log.w("CHECK" , "Check  1    " + fragment.getView()
> );
> Log.w("CHECK" , "Check  2    " + fragment.view
> );
>
> Both Check 1  and Check 2  return NULL
>
> My Fragment Has this
>
> public class VisitMenu extends Fragment {
>  private  View  parent    = null;
>  public   View  view      = null;
>
>
>  @Override
> public View onCreateView(LayoutInflater inflater, ViewGroup container,
> Bundle bundle) {
>  view      = inflater.inflate(R.layout.visit_menu, container, false);
>  parent    = container;
>  return view;
>  }
>
> }
>
> and ideas welcome
>
> Thanks in advance
>
>
>
> On Jun 18, 2011, at 10:40 PM, New Developer wrote:
>
> I have the SDK Updater done  and installed the  Compatibility package
>
> When I put        extends   FragmentActivity
>
> I still get      FragmentActivity cannot be resolved to a type
>
> With the offer to change to Fragment
>
> and ideas
>
> thanks again
>
>
>
>
> On Jun 18, 2011, at 1:11 AM, Dianne Hackborn wrote:
>
> Xav's blog post explains how to get the support library, which has
> FragmentActivity, through the SDK updater:
>
> http://android-developers.blogspot.com/2011/03/fragments-for-all.html
>
> On Fri, Jun 17, 2011 at 8:16 PM, New Developer <secur...@isscp.com> wrote:
>
>> Dianne
>> Thanks  and yes is was your blogspot article at the bottom that refers to
>>  FragmentActivity
>>
>> But I can not find this anywhere  and when I type it ,  it is unknown
>>
>> thanks again
>>
>> On Jun 17, 2011, at 7:57 PM, Dianne Hackborn wrote:
>>
>> Blog posts:
>>
>>
>> http://android-developers.blogspot.com/2011/02/android-30-fragments-api.html
>> http://android-developers.blogspot.com/2011/03/fragments-for-all.html
>>
>> SDK documentation:
>>
>> http://developer.android.com/guide/topics/fundamentals/fragments.html
>> http://developer.android.com/reference/android/app/Fragment.html
>>
>> I would suggest that for now you ignore the <fragment> tag; all it is, is
>> a convenience for doing certain things.  Learn how to directly use the
>> Fragment APIs and how those work with activities, and then once you are done
>> with those basic concepts you can throw in <fragment> layout tags.
>>
>> (I should probably adjust the Fragment java doc to reflect this approach
>> as well.)
>>
>> On Fri, Jun 17, 2011 at 4:42 PM, New Developer <secur...@isscp.com>wrote:
>>
>>> Could someone please clarify the method in which to use fragment
>>>
>>> There is a Main Activity which has a  <fragment  element within it's
>>> layout
>>>
>>> this fragment element is then loaded to a class the extends  Fragment
>>> But does the fragment class then have it's own activity ?  or
>>> how do you access the elements within the fragment ?
>>> For discussion let us say the fragment has a Button and EditText
>>>
>>> Under  a normal activity  you could access it with
>>> (Button) findViewbyId(R.id.button);   but when I put this into a fragment
>>> extended class
>>> findViewById  gives an error ?
>>>
>>> Also there is one article on Fragment which has a FragmentActivity  or
>>> ActivityFragment
>>> But I can not find this anywhere
>>>
>>> Thanks in advance
>>>
>>> --
>>> 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
>>>
>>
>>
>>
>> --
>> 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
>>
>>
>>
>> --
>> 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
>>
>
>
>
> --
> 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
>
>
>
> --
> 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
>
>
>  --
> 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
>



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