Well, you can definitely use WebView in fragments: https://github.com/commonsguy/cw-android/tree/master/Fragments/EU4You_6
My best guess is that the fragment is not yet attached to the view hierarchy by then. Since you get the same Bundle in both places, you may just want to move your loadURL() or whatever call to onCreateView(). On Sun, Mar 20, 2011 at 10:25 AM, Chris Stewart <cstewart...@gmail.com> wrote: > I'm trying to get a hook to a WebView in my layout and it's coming back null > each time. Can anyone tell me what I'm doing wrong here? > WebViewFragment.java > public class WebViewFragment extends Fragment > { > private View mContentView; > > @Override > public View onCreateView(LayoutInflater inflater, ViewGroup container, > Bundle savedInstanceState) > { > mContentView = inflater.inflate(R.layout.web_view_fragment, null); > return mContentView; > } > > @Override > public void onActivityCreated(Bundle savedInstanceState) > { > super.onActivityCreated(savedInstanceState); > > WebView webview = (WebView)mContentView.findViewById(R.id.webview); > // use webview to set url... > } > } > > web_view_fragment.xml > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" > android:orientation="horizontal" > android:layout_width="match_parent" > android:layout_height="match_parent"> > > <WebView > android:id="@+id/webview" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > android:layout_weight="2" /> > </LinearLayout> -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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