views:

91

answers:

0

Hello, I am making a twitter client for android. While retrieving the request token i want to pass a URI so that my activity can be resumed. I keep getting error with this. However when i tried passing null it the browser opens up but it doesnt go back to the activity.

I am attaching my code below:

protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); Log.d("ALI_client","Starting the oauth activity"); // We don't need to worry about any saved states: we can reconstruct the state consumer = new CommonsHttpOAuthConsumer( Keys.TWITTER_CONSUMER_KEY, Keys.TWITTER_CONSUMER_SECRET);

    provider = new CommonsHttpOAuthProvider (
            TWITTER_REQUEST_TOKEN_URL, 
            TWITTER_ACCESS_TOKEN_URL,
            TWITTER_AUTHORIZE_URL);

    // It turns out this was the missing thing to making standard Activity launch mode work
    provider.setOAuth10a(true);

    Intent i = this.getIntent();
    if(i.getData()==null) {
        //get the request token
        String authURL;
        try {
            authURL = provider.retrieveRequestToken(consumer, OAuth.OUT_OF_BAND );
            this.startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(authURL)));
        } catch (OAuthMessageSignerException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (OAuthNotAuthorizedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (OAuthExpectationFailedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (OAuthCommunicationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
}

}

Manifest is:

Please help