本文整理汇总了Java中io.reactivex.subscribers.DefaultSubscriber类的典型用法代码示例。如果您正苦于以下问题:Java DefaultSubscriber类的具体用法?Java DefaultSubscriber怎么用?Java DefaultSubscriber使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultSubscriber类属于io.reactivex.subscribers包,在下文中一共展示了DefaultSubscriber类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: btn1_RunSingleTaskAfter2s
import io.reactivex.subscribers.DefaultSubscriber; //导入依赖的package包/类
@OnClick(R.id.btn_demo_timing_1)
public void btn1_RunSingleTaskAfter2s() {
_log(String.format("A1 [%s] --- BTN click", _getCurrentTimestamp()));
Flowable.timer(2, TimeUnit.SECONDS) //
.subscribe(
new DefaultSubscriber<Long>() {
@Override
public void onNext(Long number) {
_log(String.format("A1 [%s] NEXT", _getCurrentTimestamp()));
}
@Override
public void onError(Throwable e) {
Timber.e(e, "something went wrong in TimingDemoFragment example");
}
@Override
public void onComplete() {
_log(String.format("A1 [%s] XXX COMPLETE", _getCurrentTimestamp()));
}
});
}
开发者ID:kaushikgopal,项目名称:RxJava-Android-Samples,代码行数:24,代码来源:TimingDemoFragment.java
示例2: btn4_RunTask5Times_IntervalOf3s
import io.reactivex.subscribers.DefaultSubscriber; //导入依赖的package包/类
@OnClick(R.id.btn_demo_timing_4)
public void btn4_RunTask5Times_IntervalOf3s() {
_log(String.format("D4 [%s] --- BTN click", _getCurrentTimestamp()));
Flowable.interval(3, TimeUnit.SECONDS)
.take(5)
.subscribe(
new DefaultSubscriber<Long>() {
@Override
public void onNext(Long number) {
_log(String.format("D4 [%s] NEXT", _getCurrentTimestamp()));
}
@Override
public void onError(Throwable e) {
Timber.e(e, "something went wrong in TimingDemoFragment example");
}
@Override
public void onComplete() {
_log(String.format("D4 [%s] XXX COMPLETE", _getCurrentTimestamp()));
}
});
}
开发者ID:kaushikgopal,项目名称:RxJava-Android-Samples,代码行数:25,代码来源:TimingDemoFragment.java
示例3: main
import io.reactivex.subscribers.DefaultSubscriber; //导入依赖的package包/类
public static void main(String[] args) {
// TODO Auto-generated method stub
Flowable< Long> flowable=Flowable.rangeLong(2, 12);
flowable.subscribe(new DefaultSubscriber<Long>() {
@Override
public void onComplete() {
// TODO Auto-generated method stub
System.out.println("Its Done!!!");
}
@Override
public void onError(Throwable throwable) {
// TODO Auto-generated method stub
throwable.printStackTrace();
}
@Override
public void onNext(Long value) {
// TODO Auto-generated method stub
if(value==4)
cancel();
System.out.println("value:-" + value);
}
@Override
protected void onStart() {
// TODO Auto-generated method stub
request(5);
}
});
}
开发者ID:PacktPublishing,项目名称:Reactive-Programming-With-Java-9,代码行数:38,代码来源:DemoDefaultSubscriber.java
示例4: getDanmuDetail
import io.reactivex.subscribers.DefaultSubscriber; //导入依赖的package包/类
@Override
public void getDanmuDetail(String roomid, String live_type) {
if (live_type.equals("panda")) {
RetrofitHelper.getPandaHelper().create(LiveAPI.class)
.getPandaChatroom(roomid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new DefaultSubscriber<LivePandaBean>() {
@Override
public void onComplete() {
}
@Override
public void onError(Throwable e) {
// view.showError("弹幕服务器接口已过期,请刷新直播列表!");
view.showError(e.getMessage());
}
@Override
public void onNext(LivePandaBean detailPandaBean) {
if (detailPandaBean.getErrno() == 0) {
view.updateChatDetail(detailPandaBean);
} else {
view.showError(detailPandaBean.getErrmsg());
}
}
});
} else {
view.showError("直播平台:" + live_type + "!不是熊猫TV的弹幕池!");
}
}
开发者ID:452MJ,项目名称:C9MJ,代码行数:33,代码来源:LivePlayPresenterImpl.java
示例5: btn5_RunTask5Times_IntervalOf3s
import io.reactivex.subscribers.DefaultSubscriber; //导入依赖的package包/类
@OnClick(R.id.btn_demo_timing_5)
public void btn5_RunTask5Times_IntervalOf3s() {
_log(String.format("D5 [%s] --- BTN click", _getCurrentTimestamp()));
Flowable.just("Do task A right away")
.doOnNext(input -> _log(String.format("D5 %s [%s]", input, _getCurrentTimestamp())))
.delay(1, TimeUnit.SECONDS)
.doOnNext(
oldInput ->
_log(
String.format(
"D5 %s [%s]", "Doing Task B after a delay", _getCurrentTimestamp())))
.subscribe(
new DefaultSubscriber<String>() {
@Override
public void onComplete() {
_log(String.format("D5 [%s] XXX COMPLETE", _getCurrentTimestamp()));
}
@Override
public void onError(Throwable e) {
Timber.e(e, "something went wrong in TimingDemoFragment example");
}
@Override
public void onNext(String number) {
_log(String.format("D5 [%s] NEXT", _getCurrentTimestamp()));
}
});
}
开发者ID:kaushikgopal,项目名称:RxJava-Android-Samples,代码行数:31,代码来源:TimingDemoFragment.java
注:本文中的io.reactivex.subscribers.DefaultSubscriber类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论