Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/376.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.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
Java 回调代替WebBrowser-Android Twitter_Java_Android_Twitter - Fatal编程技术网

Java 回调代替WebBrowser-Android Twitter

Java 回调代替WebBrowser-Android Twitter,java,android,twitter,Java,Android,Twitter,因为我认为我的问题没有被很好地理解,我会改变的 显然,该应用程序工作,但没有正确重定向,所以我得到这个“页面不可用”错误。我不确定问题到底出在哪里,因为应用程序在获取requestToken时没有给出任何异常或错误 以下是异步方法中的代码: protected void onPostExecute(String file_url) { // dismiss the dialog once product deleted Log.i("onPostExec

因为我认为我的问题没有被很好地理解,我会改变的

显然,该应用程序工作,但没有正确重定向,所以我得到这个“页面不可用”错误。我不确定问题到底出在哪里,因为应用程序在获取requestToken时没有给出任何异常或错误

以下是异步方法中的代码:

    protected void onPostExecute(String file_url) {
        // dismiss the dialog once product deleted
        Log.i("onPostExecute", "finish...");
        if (pDialog != null) {
            if (pDialog.isShowing()) {
                pDialog.dismiss();
            }
        }
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(requestToken.getAuthenticationURL())));
    }
}

当应用程序进行身份验证时,twitter应再次发送我的应用程序,但将我指向回调url地址。不知道如何返回到我的应用程序。

请确保您在清单文件中添加了以下权限

<uses-permission android:name="android.permission.INTERNET" />
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

定义回调\u url=”app://exampleTwitter 然后放入舱单

<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:host="exampleTwitter"
            android:scheme="app" />
    </intent-filter>


此代码正确重定向到回调Url,而不是Web浏览器

您是否在android清单中添加了
Internet
ACCESS\u NETWORK\u STATE
权限?是的,我在代码中有它们。我看到了我的问题,它是在回调Url上,我有:
静态最终字符串TWITTER\u回调\u Url=”app://twitter";我需要什么URL才能从我的应用发布推文?好的,那么它是否解决了?不,你告诉我的不是解决方案。