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>

--
Chris Stewart
http://chriswstewart.com

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