1
I am trying to put a webView inside a fragment that refers to webView that I put inside the xml for the findViewByIdmethod Fragment only works if I extend an Activity class. Is there any way I can use it on Fragment as well?
public class VideosFragment extends Fragment
{
private WebView webView;
public VideosFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_videos, container, false);
webView = (WebView) findViewById(R.id.xp4);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("https://www.https://www.google.com/");
}
}
findViewById has an error indicating that the method is undefined.