2016-12-01 80 views
0

我試圖提示android用戶使用WebView創建youtube頻道,下面是該使用案例Creating Youtube ChannelYoutube API v3使用webView在Android上創建YouTube頻道

因此,首先,我打開mWebView使用此URL https://m.youtube.com/create_channel?chromeless=1&next=/channel_creation_done

然後,我有下面的代碼片段隱藏網絡視圖創建完成時。

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); 
    } 
}); 

然而,成功的渠道創建Web視圖鏈接後成爲https://m.youtube.com/channel_creation_done預期。並且用戶留下了全部白色webview屏幕。

規格有變化嗎?我在這裏做錯了什麼?

謝謝。

回答

0

好了,回答我的問題,問題是,所產生的url不是正是https://m.youtube.com/channel_creation_done,因爲它也有以下?一些額外的參數。

因此,解決方案是使用下面的代碼行

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