Twitter app sends incorrect Activity result after successfully creating a tweet



I’m composing a Tweet and then launching Twitter app to create that Tweet on user’s profile. Following is the code for composing the Tweet and launching of Twitter app

TweetComposer.Builder builder = new TweetComposer.Builder(this).text(tweetText);
Intent intent = builder.createIntent();
startActivityForResult(intent, TWEET_REQUEST_CODE);

Then I read whether the Tweet was successully created or not through following code:

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode = TWEET_REQUEST_CODE && resultCode == RESULT_OK) {
        //do some operation

The problem is that I get resultCode = RESULT_CANCELED in onActivityResult despite the Tweet successfully created in Twitter app and appearing on user’s timeline and hence the question Why am I getting RESULT CANCELED instead of RESULT_OK?

I’m not handling user login in my app and let Twitter app to handle that for me. Following is the setup code for Fabric:

TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
Fabric.with(this, new Twitter(authConfig), new TweetComposer());

Version of Twitter SDK: 2.3.2
Version of Twitter App: 6.48.0


Hello! Faced the same issue. When I updated twitter sdk to 3.0.0 - I faced another issue: TweetComposer has lost it’s public constructor TweetComposer(authConfig), so it was impossible to init Fabric.
Have you found the solution already?


@harrysingh I will follow-up with the Twitter Android team regarding result codes. Note the result code doesn’t indicate Tweet was actually created. Only that the Tweet button was clicked and the Activity was dismissed.

@igrecha Have you seen our Upgrading Guide? Twitter kit is no longer initialized thru Fabric.


Thank you! Looking forward for your answer.
And thanks for that guide.


Hi! same issue here. @EricFrohnhoefer Before the 3.0 update the result code returned -1 if the tweet button was clicked and 0 if the user canceled the tweet (Activity was dismissed), that way we could differentiate the answer, but now always returns 0 or RESULT_CANCELED.

Is there no way to differentiate when the post was successfully sent without migrating to version 3.0?

IMPORTANT: The problem does not always happen, since I have some users who still work well and other users to whom the answer always returns 0

@harrysingh do you solve the problem?


@Sebastian @igrecha I ended up upgrading the Twitter Kit to 3.0 which did not depend on Twitter app to share the Tweet. See the Twitter Kit Native Composer method here. It works quite well if you only want to Tweet text. But I was unable to attach an image with the Tweet using Twitter Kit 3.0. There is an year old issue to which there is still no solution which prevents you from attaching the image.