Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/199.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 未在Webview应用程序中同时打开rtsp://和market://url_Android_Webview_Google Play_Rtsp - Fatal编程技术网

Android 未在Webview应用程序中同时打开rtsp://和market://url

Android 未在Webview应用程序中同时打开rtsp://和market://url,android,webview,google-play,rtsp,Android,Webview,Google Play,Rtsp,我做webview应用程序。我想在默认视频播放器和播放商店中打开URL“rtsp://”和“market://”。 我使用这个代码。但问题是“market://”url在play store中正确打开,但在默认视频播放器中未打开rtsp链接。错误表示找不到页面 public class MainActivity extends Activity { //private Button button; private WebView webView; public void onCreate(Bu

我做webview应用程序。我想在默认视频播放器和播放商店中打开URL“rtsp://”和“market://”。 我使用这个代码。但问题是“market://”url在play store中正确打开,但在默认视频播放器中未打开rtsp链接。错误表示找不到页面

public class MainActivity extends Activity {

//private Button button;
private WebView webView;
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    webView = (WebView) findViewById(R.id.webView1);

    startWebView("http://google.com");


    this.webView.setWebViewClient(new WebViewClient());
    this.webView.setDownloadListener(new DownloadListener()
    {
      public void onDownloadStart(String paramAnonymousString1, String paramAnonymousString2, String paramAnonymousString3, String paramAnonymousString4, long paramAnonymousLong)
      {
        Intent localIntent = new Intent("android.intent.action.VIEW", Uri.parse(paramAnonymousString1));
        MainActivity.this.startActivity(localIntent);
      }
    });
    this.webView.setWebViewClient(new WebViewClient()
    {
      public boolean shouldOverrideUrlLoading(WebView paramAnonymousWebView, String paramAnonymousString)
      {
        if (paramAnonymousString.startsWith("rtsp"))
        {
          Intent localIntent = new Intent("android.intent.action.VIEW", Uri.parse(paramAnonymousString));
          MainActivity.this.startActivity(localIntent);
          return true;
        }
        return super.shouldOverrideUrlLoading(paramAnonymousWebView, paramAnonymousString);
      }
    });


    this.webView.setWebViewClient(new WebViewClient()
    {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (Uri.parse(url).getScheme().equals("market")) {
                try {
                    Intent intent = new Intent(Intent.ACTION_VIEW);
                    intent.setData(Uri.parse(url));
                    Activity host = (Activity) view.getContext();
                    host.startActivity(intent);
                    return true;
                } catch (ActivityNotFoundException e) {
                    // Google Play app is not installed, you may want to open the app store link
                    Uri uri = Uri.parse(url);
                    view.loadUrl("http://play.google.com/store/apps/" + uri.getHost() + "?" + uri.getQuery());
                    return false;
                }

            }
            return false;
        }
    });



    }

请相信对webView.setWebViewClient()的多个调用正在相互覆盖。Play store可以工作,因为这是最后一次通话。但不管怎样,“找不到页面”是对您的问题的一个非常明显的答案。我想打开这两个URL。给我一个解决方案。