【问题标题】:Youtube API v3 Create Youtube Channel on Android with webViewYoutube API v3 使用 webView 在 Android 上创建 Youtube 频道
【发布时间】:2017-04-15 18:25:54
【问题描述】:

我正在尝试提示 android 用户使用 WebView 在此用例 Creating Youtube Channel 之后创建 youtube 频道。

所以,首先,我使用这个网址https://m.youtube.com/create_channel?chromeless=1&next=/channel_creation_done 打开mWebView

然后,我有以下代码 sn-p 在创建完成时隐藏 web-view。

mWebView.setWebViewClient(new WebViewClient() {
   public void onPageFinished(WebView view, String url) {
        if ("https://m.youtube.com/channel_creation_done".equals(url))
             view.setVisibility(View.INVISIBLE);
    }
});

但是,在成功创建频道后,网页浏览网址不会按预期变为https://m.youtube.com/channel_creation_done。并且用户留下了全白的webview 屏幕。

规格有变化吗?我在这里做错了吗?

谢谢。

【问题讨论】:

    标签: java android youtube youtube-api youtube-channels


    【解决方案1】:

    好的,所以回答我自己的问题,问题是生成的url 不是完全 https://m.youtube.com/channel_creation_done,因为它在? 之后还有一些额外的参数。

    因此解决方案是使用以下代码行

     if (url!=null && url.contains("https://m.youtube.com/channel_creation_done"))
                 view.setVisibility(View.INVISIBLE);
    

    【讨论】:

      猜你喜欢
      • 2015-06-27
      • 1970-01-01
      • 2021-01-15
      • 2015-04-17
      • 2015-08-11
      • 1970-01-01
      • 2023-03-31
      • 2015-01-02
      • 2016-01-21
      相关资源
      最近更新 更多