我需要在我的 Android 应用程序的 Fragment 上显示 Twitter 列表(Link),但我不知道如何在 Fragment 中包含 MyWebViewClient Activity .. 请帮助。
public class TwitterFragment extends Fragment {
private WebView webview;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_twitter, container, false);
String url = "https://twitter.com/Almounir/lists/intersante";
webview = (WebView) rootView.findViewById(R.id.myWebView);
//next line explained below
webview.setWebViewClient(new MyWebViewClient(this));
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl(url);
public MyWebViewClient() {
super();
//start anything you need to
}
public void onPageStarted(WebView view, String url, Bitmap favicon) {
//Do something to the urls, views, etc.
}
return rootView;
}
}