在Android的Twitter中的OAuthRequestTokenTask中的URL中获取null?

时间:2012-08-29 10:56:06

标签: android twitter

我正在使用Android应用,我需要在Twitter上发布短信。 这是非常容易的任务,我在一次拍摄中做得很好,但现在我得到了一个未知的停工。应用程序挂起“验证请稍候”对话框。

调试时我知道在 doInBackground(Void ... params)方法中的 OAuthRequestTokenTask 活动中,URL变为 null 而我得到例外。

请建议我,最新消息,在我的代码中?????

已编辑:我在以下方法的 OAuthRequestTokenTask 类中获取null:

@Override
    protected Void doInBackground(Void... params) {

        try {
            **final String url = provider.retrieveRequestToken(consumer, Constants.OAUTH_CALLBACK_URL);**
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)).setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_FROM_BACKGROUND);
            context.startActivity(intent);
        } catch (Exception e) {
            System.out.println(e+ "========");
        }

        return null;
    }

1 个答案:

答案 0 :(得分:0)

我在上述任务中取得了成功。

我正在做的错误是,没有在Twitter帐户上提供应用程序的回调URL。 :)