Search code examples
androidtwitter-fabric

Is there any callback method in twitter using fabric in android after sharing the post?


I have used the following code to post the tweet in twitter,for the custom login button

File file = captureScreen();
TweetComposer.Builder builder = new TweetComposer.Builder(getActivity())
.text("just setting up my Fabric.")
.image(Uri.fromFile(file));
builder.show();

sharing the post with image is working fine, is there any call back method to show alert to user in success.

Thanks in advance.


Solution

  • Use the code below ->

    Intent i = new TweetComposer.Builder(this)
                        .text(content)
                        .url(new URL(url))
                        .createIntent();
                startActivityForResult(i, Constants.REQUEST_CODE_TWITTER);
    
    @Override
        protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            if (requestCode == Constants.REQUEST_CODE_TWITTER) {
                if (resultCode == RESULT_OK) {
                    // do your stuff
                }
            }
        }