OnSuccess / OnFailure Feedback Composer Twitter

I am trying to determine if a tweet was successful or not. How can this be achieved on Android using Fabric (Twitter Composer)?

new TweetComposer.Builder(activity)
                                .text("#hastag").show();

What I want to do:

new TweetComposer.Builder(activity)
                                .text("#hastag").
                                .onSuccess(new Success(....))
                                .onFailure(new Failure(...)
                                .show();

I could listen on the onActivityResult method in Activity, but I was hoping there would be a cleaner and better way.

+4
source share
1 answer

Instead of using, .show();create the intention:

new Intent i = new TweetComposer.Builder(activity)
                                .text("#hastag").
                                .createIntent();

Now you can run the action for the result:

startActivityForResult(i, TWEETER_REQ_CODE);

where TWEETER_REQ_CODEis just a numeric identifier. next onActivityResultwait for the appearance TWEETER_REQ_CODE.

Hope this helps, N.

+18
source

Source: https://habr.com/ru/post/1570045/


All Articles