我試圖在我的應用上打開一個YouTube鏈接,在外部窗口/選項卡中打開。誰能幫我?android eclipse和外部URL
這裏是我的代碼:
import com.actionbarsherlock.app.SherlockFragment;
public class Showing_now extends SherlockFragment{
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View mainView = (View) inflater.inflate(R.layout.activity_showing_now, container, false);
WebView webView = (WebView) mainView.findViewById(R.id.webViewsn);
webView.setWebViewClient(new MyWebViewClient());
webView.getSettings().setPluginsEnabled(true);
webView.getSettings().setBuiltInZoomControls(false);
webView.getSettings().setSupportZoom(false);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.getSettings().setAllowFileAccess(true);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginState(PluginState.ON);
webView.loadUrl("http://www.myweburl.com");
return mainView;
}
private class MyWebViewClient extends WebViewClient {
}
}
上述代碼會發生什麼情況? – Raghunandan
確保你在你的'AndroidManifest.xml'中有這個:' ''http://stackoverflow.com/a/2378619/833647 –