简体   繁体   English

Twitter Composer回调OnSuccess / OnFailure Fabric

[英]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.

相关问题 未覆盖AsyncHttpClient OnSuccess或OnFailure,但已收到回调 - AsyncHttpClient OnSuccess or OnFailure was not overriden, but callback was received asyncHttpClient没有onSuccess或onFailure运行 - asyncHttpClient no onSuccess or onFailure run Firebase getDownloadUrl 不执行 onSuccess 或 onFailure - Firebase getDownloadUrl doesn't execute onSuccess or onFailure 世界时间 API 调用触发 onFailure 而不是 onSuccess - World Time API call firing up the onFailure instead of onSuccess Akka未来成功失败均未执行 - akka future onsuccess onfailure both didn't execute onSuccess/onFailure 能否替换vert.x 中CompositeFuture 的setHandler? - Can onSuccess/onFailure replace setHandler of CompositeFuture in vert.x? Android Twitter登录不使用Fabric SDK - 回调不能为空 - Android Twitter login not working with Fabric SDK - Callback must not be null 在回调Android Studio中获得故障响应 - Getting onFailure Response in Callback Android Studio 在Android应用程序中使用Fabric Twitter Kit加载用户时间线时无法设置回调 - Can't set callback while loading user timeline using Fabric Twitter Kit in Android application 实现callBack(onSuccess())的方法是否返回onSucess()返回的值? - does a method implementing a callBack (onSuccess()) return the value returned by onSucess()?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM