我正在嘗試從Android Twitter oAuth Connect Tutorial代碼,它的工作成功。我嘗試將Twitter授權頁面更改爲在WebView中運行,而不是Web瀏覽器,但WebView似乎無法加載此格式的url,這是鏈接回到我的應用程序的鏈接。成功授權後,webview應關閉併成功返回到我的應用程序。WebView無法加載oAuth網址
有一個錯誤:「oauth:// twittersample?oauth_token = ....的網頁可能暫時關閉,或者它可能永久移動到新的網址」。我該怎麼辦?
這是段我的WebView這是在我的onCreate
WebView myWebView = (WebView)findViewById(R.id.myWebView);
myWebView.setWebViewClient(new WebViewClient()
{
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String url)
{
if (url != null && url.startsWith("oauth://twittersample"))
//handleTwitterCallback(url);
{
System.out.println("TWEET TWEET TWEET");
webView.loadUrl(url);
return true;
}
else
return false;
}
});
這是鏈接到我的Twitter的java類TWITTER CONNECT CLASS 這是我的清單
<activity android:name="com.test.settings.ShareSettings" android:label="ShareSettings" android:screenOrientation="portrait" android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="oauth" android:host="twittersample"/>
</intent-filter>
</activity>
附件爲logcat的在瀏覽器中成功運行時
請不要在您的問題標題中添加「已解決」。選擇一個正確答案會自動顯示問題列表中的問題。 – hjpotter92