Question

I'm using twitter4J to tweet with my Android App, here is a snippet of my code:

 try{
        AccessToken at = mTwitter.getOAuthAccessToken(mReqToken, v);

        mTwitter.setOAuthAccessToken(at);
        status = mTwitter.updateStatus("This is the hook ...");

        Log.e("TWITTER-STATUS", " = " + status.getText());

    }

    catch (Exception e){

        Log.e("TWITTER-KO", "");
    }

The getOAuthAccessToken() method is always failing and give the "TWITTER-KO" Log, the properties mReqToken and v are 2 strings which respectively contains my token access and the retrieved verifier string.The rest of the code like twitter4J authorization and setting the authorization are right. Can you please tell me what I'm doing wrong, I would like to post a tweet with my Android app.

Was it helpful?

Solution

I got it, the problem was I just need to paste this code into a handler or Async task, because my activity can't handle it from the main thread.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top