[英]Twitter Composer Callback OnSuccess/OnFailure Fabric
I am trying to detect whether the tweet was successful or not. 我试图检测推文是否成功。 How can this be achieved on Android using the Fabric (Twitter Composer) api? 如何在Android上使用Fabric(Twitter Composer)api实现这一目标?
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 to the onActivityResult method in the Activity but I was hoping there would be a cleaner and better way. 我可以在Activity中听取onActivityResult方法,但我希望有更清洁,更好的方法。
Instead of using .show();
而不是使用.show();
, create an intent like this : ,创建一个这样的意图:
new Intent i = new TweetComposer.Builder(activity)
.text("#hastag").
.createIntent();
Now you can start the activity for result : 现在您可以开始结果活动:
startActivityForResult(i, TWEETER_REQ_CODE);
where TWEETER_REQ_CODE
is just a numerical identifier. 其中TWEETER_REQ_CODE
只是一个数字标识符。 next onActivityResult
wait for the TWEETER_REQ_CODE
to show up. 接下来onActivityResult
等待TWEETER_REQ_CODE
出现。
Hope it helped, N. 希望它有所帮助,N。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.