{"id":56638,"date":"2025-08-14T21:24:57","date_gmt":"2025-08-14T13:24:57","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/56638.html"},"modified":"2025-08-14T21:24:57","modified_gmt":"2025-08-14T13:24:57","slug":"rxjava-android-%e5%88%9b%e5%bb%ba%e6%93%8d%e4%bd%9c%e7%ac%a6%e5%ae%9e%e6%88%98%ef%bc%9a%e4%bb%8e%e6%95%b0%e6%8d%ae%e6%ba%90%e5%88%b0observable","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/56638.html","title":{"rendered":"RxJava Android \u521b\u5efa\u64cd\u4f5c\u7b26\u5b9e\u6218\uff1a\u4ece\u6570\u636e\u6e90\u5230Observable"},"content":{"rendered":"<h3>\u5f15\u8a00<\/h3>\n<p>\u5728Android\u5f00\u53d1\u4e2d&#xff0c;\u521b\u5efaObservable\u662f\u4f7f\u7528RxJava\u7684\u7b2c\u4e00\u6b65\u3002RxJava\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u521b\u5efa\u64cd\u4f5c\u7b26&#xff0c;\u8ba9\u6211\u4eec\u80fd\u591f\u5c06\u5404\u79cd\u6570\u636e\u6e90\u8f6c\u6362\u4e3a\u53ef\u89c2\u5bdf\u5e8f\u5217\u3002\u672c\u6587\u5c06\u6df1\u5165\u8bb2\u89e3RxJava\u4e2d\u6700\u5e38\u7528\u7684\u521b\u5efa\u64cd\u4f5c\u7b26&#xff0c;\u5e76\u901a\u8fc7Android\u5b9e\u9645\u6848\u4f8b\u5c55\u793a\u5b83\u4eec\u7684\u5e94\u7528\u573a\u666f\u548c\u6700\u4f73\u5b9e\u8df5\u3002<\/p>\n<h3>\u4e00\u3001\u57fa\u7840\u521b\u5efa\u64cd\u4f5c\u7b26<\/h3>\n<h4>1. just() &#8211; \u76f4\u63a5\u53d1\u5c04\u6570\u636e<\/h4>\n<p>just()\u662f\u6700\u7b80\u5355\u7684\u521b\u5efa\u64cd\u4f5c\u7b26&#xff0c;\u7528\u4e8e\u5c06\u5df2\u6709\u6570\u636e\u8f6c\u6362\u4e3aObservable&#xff1a;<\/p>\n<p>kotlin<\/p>\n<p>\/\/ \u53d1\u5c04\u5355\u4e2a\u6570\u636e<br \/>\nObservable.just(&#034;Hello RxJava&#034;)<br \/>\n    .subscribe { log -&gt; Log.d(&#034;TAG&#034;, log) }<\/p>\n<p>\/\/ \u53d1\u5c04\u591a\u4e2a\u6570\u636e&#xff08;\u6700\u591a10\u4e2a&#xff09;<br \/>\nObservable.just(1, 2, 3, 4, 5)<br \/>\n    .subscribe { num -&gt; Log.d(&#034;TAG&#034;, &#034;Number: $num&#034;) }<\/p>\n<p>Android\u5e94\u7528\u573a\u666f&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5feb\u901f\u521b\u5efa\u6d4b\u8bd5\u6570\u636e<\/p>\n<\/li>\n<li>\n<p>\u5c06\u5e38\u91cf\u6216\u914d\u7f6e\u503c\u5305\u88c5\u4e3aObservable<\/p>\n<\/li>\n<\/ul>\n<h4>2. from() \u7cfb\u5217 &#8211; \u4ece\u96c6\u5408\/\u6570\u7ec4\u521b\u5efa<\/h4>\n<p>RxJava\u63d0\u4f9b\u4e86\u591a\u79cdfrom\u64cd\u4f5c\u7b26\u6765\u5904\u7406\u96c6\u5408\u6570\u636e&#xff1a;<\/p>\n<p>kotlin<\/p>\n<p>\/\/ fromIterable &#8211; \u4ece\u96c6\u5408\u521b\u5efa<br \/>\nval list &#061; listOf(&#034;Apple&#034;, &#034;Banana&#034;, &#034;Orange&#034;)<br \/>\nObservable.fromIterable(list)<br \/>\n    .subscribe { fruit -&gt; Log.d(&#034;TAG&#034;, fruit) }<\/p>\n<p>\/\/ fromArray &#8211; \u4ece\u6570\u7ec4\u521b\u5efa<br \/>\nval array &#061; arrayOf(1, 2, 3)<br \/>\nObservable.fromArray(*array)<br \/>\n    .subscribe { num -&gt; Log.d(&#034;TAG&#034;, num.toString()) }<\/p>\n<p>\/\/ fromCallable &#8211; \u5ef6\u8fdf\u6267\u884c\u4ee3\u7801\u5757<br \/>\nObservable.fromCallable {<br \/>\n    \/\/ \u6a21\u62df\u8017\u65f6\u64cd\u4f5c<br \/>\n    Thread.sleep(1000)<br \/>\n    &#034;Result from background&#034;<br \/>\n}.subscribeOn(Schedulers.io())<br \/>\n .observeOn(AndroidSchedulers.mainThread())<br \/>\n .subscribe { result -&gt;<br \/>\n    textView.text &#061; result<br \/>\n }<\/p>\n<p>Android\u5e94\u7528\u573a\u666f&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5c06\u6570\u636e\u5e93\u67e5\u8be2\u7ed3\u679c\u8f6c\u6362\u4e3a\u6d41<\/p>\n<\/li>\n<li>\n<p>\u5904\u7406\u6587\u4ef6\u8bfb\u53d6\u64cd\u4f5c<\/p>\n<\/li>\n<li>\n<p>\u8f6c\u6362\u7f51\u7edc\u8bf7\u6c42\u7ed3\u679c<\/p>\n<\/li>\n<\/ul>\n<h3>\u4e8c\u3001\u9ad8\u7ea7\u521b\u5efa\u64cd\u4f5c\u7b26<\/h3>\n<h4>3. create() &#8211; \u5b8c\u5168\u63a7\u5236Observable\u521b\u5efa<\/h4>\n<p>create()\u63d0\u4f9b\u4e86\u6700\u5927\u7684\u7075\u6d3b\u6027&#xff0c;\u53ef\u4ee5\u624b\u52a8\u63a7\u5236\u6570\u636e\u53d1\u5c04&#xff1a;<\/p>\n<p>kotlin<\/p>\n<p>Observable.create&lt;String&gt; { emitter -&gt;<br \/>\n    try {<br \/>\n        \/\/ \u6a21\u62df\u7f51\u7edc\u8bf7\u6c42<br \/>\n        val response &#061; mockNetworkRequest()<br \/>\n        emitter.onNext(response)<br \/>\n        emitter.onComplete()<br \/>\n    } catch (e: Exception) {<br \/>\n        emitter.onError(e)<br \/>\n    }<br \/>\n}.subscribeOn(Schedulers.io())<br \/>\n .observeOn(AndroidSchedulers.mainThread())<br \/>\n .subscribe(<br \/>\n    { response -&gt; updateUI(response) },<br \/>\n    { error -&gt; showError(error) }<br \/>\n )<\/p>\n<p>\u6ce8\u610f\u4e8b\u9879&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5fc5\u987b\u8003\u8651\u80cc\u538b\u95ee\u9898<\/p>\n<\/li>\n<li>\n<p>\u786e\u4fdd\u6b63\u786e\u8c03\u7528onComplete\/onError<\/p>\n<\/li>\n<li>\n<p>\u907f\u514d\u5728create\u4e2d\u76f4\u63a5\u6267\u884c\u8017\u65f6\u64cd\u4f5c<\/p>\n<\/li>\n<\/ul>\n<h4>4. defer() &#8211; \u5ef6\u8fdf\u521b\u5efaObservable<\/h4>\n<p>defer()\u76f4\u5230\u6709\u8ba2\u9605\u8005\u65f6\u624d\u521b\u5efaObservable&#xff0c;\u786e\u4fdd\u83b7\u53d6\u6700\u65b0\u6570\u636e&#xff1a;<\/p>\n<p>kotlin<\/p>\n<p>var count &#061; 0<\/p>\n<p>\/\/ \u4e0d\u4f7f\u7528defer &#8211; \u521b\u5efa\u65f6\u5c31\u786e\u5b9acount\u503c<br \/>\nval badObservable &#061; Observable.just(count)<\/p>\n<p>\/\/ \u4f7f\u7528defer &#8211; \u8ba2\u9605\u65f6\u624d\u83b7\u53d6count\u503c<br \/>\nval goodObservable &#061; Observable.defer {<br \/>\n    Observable.just(count)<br \/>\n}<\/p>\n<p>count &#061; 5<\/p>\n<p>badObservable.subscribe { Log.d(&#034;TAG&#034;, &#034;Bad: $it&#034;) }  \/\/ \u8f93\u51fa0<br \/>\ngoodObservable.subscribe { Log.d(&#034;TAG&#034;, &#034;Good: $it&#034;) } \/\/ \u8f93\u51fa5<\/p>\n<p>Android\u5e94\u7528\u573a\u666f&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4f9d\u8d56\u52a8\u6001\u914d\u7f6e\u7684\u8bf7\u6c42<\/p>\n<\/li>\n<li>\n<p>\u9700\u8981\u83b7\u53d6\u5b9e\u65f6\u6570\u636e\u7684\u573a\u666f<\/p>\n<\/li>\n<li>\n<p>\u907f\u514d\u503c\u5728\u521b\u5efa\u548c\u8ba2\u9605\u4e4b\u95f4\u53d8\u5316\u7684\u95ee\u9898<\/p>\n<\/li>\n<\/ul>\n<h3>\u4e09\u3001\u65f6\u95f4\u76f8\u5173\u521b\u5efa\u64cd\u4f5c\u7b26<\/h3>\n<h4>5. interval() &#8211; \u5b9a\u65f6\u53d1\u5c04\u6570\u636e<\/h4>\n<p>interval()\u5b9a\u671f\u53d1\u5c04\u9012\u589e\u7684Long\u503c&#xff1a;<\/p>\n<p>kotlin<\/p>\n<p>\/\/ \u6bcf1\u79d2\u53d1\u5c04\u4e00\u4e2a\u6570\u5b57&#xff0c;\u4ece0\u5f00\u59cb<br \/>\nObservable.interval(1, TimeUnit.SECONDS)<br \/>\n    .takeUntil(lifecycleEventObservable) \/\/ \u914d\u5408\u751f\u547d\u5468\u671f\u7ba1\u7406<br \/>\n    .observeOn(AndroidSchedulers.mainThread())<br \/>\n    .subscribe { count -&gt;<br \/>\n        timerText.text &#061; &#034;Count: $count&#034;<br \/>\n    }<\/p>\n<p>Android\u5e94\u7528\u573a\u666f&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5b9e\u73b0\u8ba1\u65f6\u5668\/\u5012\u8ba1\u65f6<\/p>\n<\/li>\n<li>\n<p>\u8f6e\u8be2\u8bf7\u6c42<\/p>\n<\/li>\n<li>\n<p>\u52a8\u753b\u5e27\u63a7\u5236<\/p>\n<\/li>\n<\/ul>\n<h4>6. timer() &#8211; \u5ef6\u8fdf\u6267\u884c<\/h4>\n<p>timer()\u5728\u6307\u5b9a\u5ef6\u8fdf\u540e\u53d1\u5c04\u4e00\u4e2a0L&#xff1a;<\/p>\n<p>kotlin<\/p>\n<p>\/\/ 3\u79d2\u540e\u6267\u884c<br \/>\nObservable.timer(3, TimeUnit.SECONDS)<br \/>\n    .observeOn(AndroidSchedulers.mainThread())<br \/>\n    .subscribe {<br \/>\n        showSplashScreen(false)<br \/>\n    }<\/p>\n<p>Android\u5e94\u7528\u573a\u666f&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u542f\u52a8\u9875\u5ef6\u8fdf\u8df3\u8f6c<\/p>\n<\/li>\n<li>\n<p>\u5ef6\u65f6\u6267\u884c\u4efb\u52a1<\/p>\n<\/li>\n<li>\n<p>\u9632\u6296\u540e\u7684\u5ef6\u8fdf\u64cd\u4f5c<\/p>\n<\/li>\n<\/ul>\n<h3>\u56db\u3001Android\u5b9e\u6218\u6848\u4f8b<\/h3>\n<h4>\u6848\u4f8b1&#xff1a;\u591a\u4e2a\u7f51\u7edc\u8bf7\u6c42\u987a\u5e8f\u6267\u884c<\/h4>\n<p>kotlin<\/p>\n<p>\/\/ \u4f7f\u7528fromIterable &#043; concatMap\u5b9e\u73b0\u987a\u5e8f\u8bf7\u6c42<br \/>\nObservable.fromIterable(apiList)<br \/>\n    .concatMap { api -&gt;<br \/>\n        RetrofitClient.getService(api)<br \/>\n            .subscribeOn(Schedulers.io())<br \/>\n    }<br \/>\n    .observeOn(AndroidSchedulers.mainThread())<br \/>\n    .subscribe { response -&gt;<br \/>\n        \/\/ \u5904\u7406\u6bcf\u4e2a\u54cd\u5e94<br \/>\n    }<\/p>\n<h4>\u6848\u4f8b2&#xff1a;\u8868\u5355\u9a8c\u8bc1<\/h4>\n<p>kotlin<\/p>\n<p>\/\/ \u4f7f\u7528combineLatest\u76d1\u542c\u591a\u4e2a\u8f93\u5165\u6846<br \/>\nObservable.combineLatest(<br \/>\n    RxTextView.textChanges(editText1).skip(1),<br \/>\n    RxTextView.textChanges(editText2).skip(1),<br \/>\n    RxTextView.textChanges(editText3).skip(1)<br \/>\n) { text1, text2, text3 -&gt;<br \/>\n    validateForm(text1.toString(), text2.toString(), text3.toString())<br \/>\n}.subscribe { isValid -&gt;<br \/>\n    submitButton.isEnabled &#061; isValid<br \/>\n}<\/p>\n<h4>\u6848\u4f8b3&#xff1a;\u641c\u7d22\u9632\u6296<\/h4>\n<p>kotlin<\/p>\n<p>RxTextView.textChanges(searchEditText)<br \/>\n    .debounce(300, TimeUnit.MILLISECONDS) \/\/ \u9632\u6296300ms<br \/>\n    .filter { it.length &gt;&#061; 3 } \/\/ \u81f3\u5c113\u4e2a\u5b57\u7b26\u624d\u641c\u7d22<br \/>\n    .distinctUntilChanged() \/\/ \u5185\u5bb9\u53d8\u5316\u624d\u641c\u7d22<br \/>\n    .switchMap { query -&gt;<br \/>\n        searchApi.search(query.toString())<br \/>\n            .onErrorReturn { emptyList() }<br \/>\n    }<br \/>\n    .observeOn(AndroidSchedulers.mainThread())<br \/>\n    .subscribe { results -&gt;<br \/>\n        updateSearchResults(results)<br \/>\n    }<\/p>\n<h3>\u4e94\u3001\u521b\u5efa\u64cd\u4f5c\u7b26\u9009\u62e9\u6307\u5357<\/h3>\n<table>\n<tr>\u64cd\u4f5c\u7b26\u9002\u7528\u573a\u666f\u662f\u5426\u5ef6\u8fdf\u6267\u884c\u662f\u5426\u652f\u6301\u80cc\u538b<\/tr>\n<tbody>\n<tr>\n<td>just()<\/td>\n<td>\u5df2\u77e5\u56fa\u5b9a\u6570\u636e<\/td>\n<td>\u5426<\/td>\n<td>\u5426<\/td>\n<\/tr>\n<tr>\n<td>fromIterable()<\/td>\n<td>\u96c6\u5408\/\u5217\u8868\u6570\u636e<\/td>\n<td>\u5426<\/td>\n<td>\u5426<\/td>\n<\/tr>\n<tr>\n<td>fromCallable()<\/td>\n<td>\u9700\u8981\u5ef6\u8fdf\u8ba1\u7b97\u7684\u503c<\/td>\n<td>\u662f<\/td>\n<td>\u5426<\/td>\n<\/tr>\n<tr>\n<td>create()<\/td>\n<td>\u5b8c\u5168\u81ea\u5b9a\u4e49\u6570\u636e\u6d41<\/td>\n<td>\u662f<\/td>\n<td>\u9700\u8981\u624b\u52a8\u5904\u7406<\/td>\n<\/tr>\n<tr>\n<td>defer()<\/td>\n<td>\u9700\u8981\u6700\u65b0\u503c\u7684\u573a\u666f<\/td>\n<td>\u662f<\/td>\n<td>\u5426<\/td>\n<\/tr>\n<tr>\n<td>interval()<\/td>\n<td>\u5b9a\u65f6\u4efb\u52a1<\/td>\n<td>\u662f<\/td>\n<td>\u662f(Flowable)<\/td>\n<\/tr>\n<tr>\n<td>timer()<\/td>\n<td>\u5ef6\u8fdf\u4efb\u52a1<\/td>\n<td>\u662f<\/td>\n<td>\u662f(Flowable)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u7ed3\u8bed<\/h3>\n<p>\u638c\u63e1RxJava\u7684\u521b\u5efa\u64cd\u4f5c\u7b26\u662f\u6784\u5efa\u54cd\u5e94\u5f0fAndroid\u5e94\u7528\u7684\u57fa\u7840\u3002\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d&#xff0c;\u5e94\u6839\u636e\u5177\u4f53\u573a\u666f\u9009\u62e9\u5408\u9002\u7684\u521b\u5efa\u65b9\u5f0f&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u7b80\u5355\u6570\u636e\u4f7f\u7528just()\u6216fromIterable()<\/p>\n<\/li>\n<li>\n<p>\u9700\u8981\u6700\u65b0\u503c\u4f7f\u7528defer()<\/p>\n<\/li>\n<li>\n<p>\u5f02\u6b65\u4efb\u52a1\u4f7f\u7528fromCallable()<\/p>\n<\/li>\n<li>\n<p>\u5b9a\u65f6\u4efb\u52a1\u4f7f\u7528interval()\u6216timer()<\/p>\n<\/li>\n<li>\n<p>\u5b8c\u5168\u81ea\u5b9a\u4e49\u6d41\u7a0b\u4f7f\u7528create()<\/p>\n<\/li>\n<\/ul>\n<p>\u6700\u4f73\u5b9e\u8df5\u63d0\u793a&#xff1a;<\/p>\n<li>\n<p>\u5728Android\u4e2d\u59cb\u7ec8\u8003\u8651\u751f\u547d\u5468\u671f\u7ba1\u7406&#xff0c;\u907f\u514d\u5185\u5b58\u6cc4\u6f0f<\/p>\n<\/li>\n<li>\n<p>\u5408\u7406\u4f7f\u7528\u7ebf\u7a0b\u8c03\u5ea6\u5668&#xff0c;\u907f\u514d\u4e3b\u7ebf\u7a0b\u963b\u585e<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u4e8e\u53ef\u80fd\u4ea7\u751f\u5927\u91cf\u6570\u636e\u7684\u573a\u666f&#xff0c;\u8003\u8651\u4f7f\u7528Flowable\u5904\u7406\u80cc\u538b<\/p>\n<\/li>\n<li>\n<p>\u590d\u6742\u7684\u521b\u5efa\u903b\u8f91\u53ef\u4ee5\u5c01\u88c5\u4e3a\u53ef\u590d\u7528\u7684\u65b9\u6cd5<\/p>\n<\/li>\n<p>\u5728\u4e0b\u4e00\u7bc7\u6587\u7ae0\u4e2d&#xff0c;\u6211\u4eec\u5c06\u6df1\u5165\u63a2\u8ba8RxJava\u7684\u53d8\u6362\u64cd\u4f5c\u7b26&#xff0c;\u5b66\u4e60\u5982\u4f55\u5bf9\u6570\u636e\u6d41\u8fdb\u884c\u8f6c\u6362\u548c\u5904\u7406\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb235\u6b21\u3002\u638c\u63e1RxJava\u7684\u521b\u5efa\u64cd\u4f5c\u7b26\u662f\u6784\u5efa\u54cd\u5e94\u5f0fAndroid\u5e94\u7528\u7684\u57fa\u7840\u3002\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\uff0c\u5e94\u6839\u636e\u5177\u4f53\u573a\u666f\u9009\u62e9\u5408\u9002\u7684\u521b\u5efa\u65b9\u5f0f\uff1a\u7b80\u5355\u6570\u636e\u4f7f\u7528just()\u6216\u9700\u8981\u6700\u65b0\u503c\u4f7f\u7528defer()\u5f02\u6b65\u4efb\u52a1\u4f7f\u7528\u5b9a\u65f6\u4efb\u52a1\u4f7f\u7528interval()\u6216timer()\u5b8c\u5168\u81ea\u5b9a\u4e49\u6d41\u7a0b\u4f7f\u7528create()\u6700\u4f73\u5b9e\u8df5\u63d0\u793a\u5728Android\u4e2d\u59cb\u7ec8\u8003\u8651\u751f\u547d\u5468\u671f\u7ba1\u7406\uff0c\u907f\u514d\u5185\u5b58\u6cc4\u6f0f\u5408\u7406\u4f7f\u7528\u7ebf\u7a0b\u8c03\u5ea6\u5668\uff0c\u907f\u514d\u4e3b\u7ebf\u7a0b\u963b\u585e\u5bf9\u4e8e\u53ef\u80fd\u4ea7\u751f\u5927\u91cf\u6570\u636e\u7684\u573a\u666f\uff0c\u8003\u8651\u4f7f\u7528Flowable\u5904\u7406\u80cc\u538b\u590d\u6742\u7684\u521b\u5efa\u903b\u8f91\u53ef\u4ee5\u5c01\u88c5\u4e3a\u53ef\u590d\u7528\u7684\u65b9\u6cd5\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[84,994,5374],"topic":[],"class_list":["post-56638","post","type-post","status-publish","format-standard","hentry","category-server","tag-android","tag-echarts","tag-rxjava"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>RxJava Android \u521b\u5efa\u64cd\u4f5c\u7b26\u5b9e\u6218\uff1a\u4ece\u6570\u636e\u6e90\u5230Observable - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/56638.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"RxJava Android \u521b\u5efa\u64cd\u4f5c\u7b26\u5b9e\u6218\uff1a\u4ece\u6570\u636e\u6e90\u5230Observable - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb235\u6b21\u3002\u638c\u63e1RxJava\u7684\u521b\u5efa\u64cd\u4f5c\u7b26\u662f\u6784\u5efa\u54cd\u5e94\u5f0fAndroid\u5e94\u7528\u7684\u57fa\u7840\u3002\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\uff0c\u5e94\u6839\u636e\u5177\u4f53\u573a\u666f\u9009\u62e9\u5408\u9002\u7684\u521b\u5efa\u65b9\u5f0f\uff1a\u7b80\u5355\u6570\u636e\u4f7f\u7528just()\u6216\u9700\u8981\u6700\u65b0\u503c\u4f7f\u7528defer()\u5f02\u6b65\u4efb\u52a1\u4f7f\u7528\u5b9a\u65f6\u4efb\u52a1\u4f7f\u7528interval()\u6216timer()\u5b8c\u5168\u81ea\u5b9a\u4e49\u6d41\u7a0b\u4f7f\u7528create()\u6700\u4f73\u5b9e\u8df5\u63d0\u793a\u5728Android\u4e2d\u59cb\u7ec8\u8003\u8651\u751f\u547d\u5468\u671f\u7ba1\u7406\uff0c\u907f\u514d\u5185\u5b58\u6cc4\u6f0f\u5408\u7406\u4f7f\u7528\u7ebf\u7a0b\u8c03\u5ea6\u5668\uff0c\u907f\u514d\u4e3b\u7ebf\u7a0b\u963b\u585e\u5bf9\u4e8e\u53ef\u80fd\u4ea7\u751f\u5927\u91cf\u6570\u636e\u7684\u573a\u666f\uff0c\u8003\u8651\u4f7f\u7528Flowable\u5904\u7406\u80cc\u538b\u590d\u6742\u7684\u521b\u5efa\u903b\u8f91\u53ef\u4ee5\u5c01\u88c5\u4e3a\u53ef\u590d\u7528\u7684\u65b9\u6cd5\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/56638.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-14T13:24:57+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/56638.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/56638.html\",\"name\":\"RxJava Android \u521b\u5efa\u64cd\u4f5c\u7b26\u5b9e\u6218\uff1a\u4ece\u6570\u636e\u6e90\u5230Observable - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-14T13:24:57+00:00\",\"dateModified\":\"2025-08-14T13:24:57+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/56638.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/56638.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/56638.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"RxJava Android \u521b\u5efa\u64cd\u4f5c\u7b26\u5b9e\u6218\uff1a\u4ece\u6570\u636e\u6e90\u5230Observable\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"RxJava Android \u521b\u5efa\u64cd\u4f5c\u7b26\u5b9e\u6218\uff1a\u4ece\u6570\u636e\u6e90\u5230Observable - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/56638.html","og_locale":"zh_CN","og_type":"article","og_title":"RxJava Android \u521b\u5efa\u64cd\u4f5c\u7b26\u5b9e\u6218\uff1a\u4ece\u6570\u636e\u6e90\u5230Observable - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb235\u6b21\u3002\u638c\u63e1RxJava\u7684\u521b\u5efa\u64cd\u4f5c\u7b26\u662f\u6784\u5efa\u54cd\u5e94\u5f0fAndroid\u5e94\u7528\u7684\u57fa\u7840\u3002\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\uff0c\u5e94\u6839\u636e\u5177\u4f53\u573a\u666f\u9009\u62e9\u5408\u9002\u7684\u521b\u5efa\u65b9\u5f0f\uff1a\u7b80\u5355\u6570\u636e\u4f7f\u7528just()\u6216\u9700\u8981\u6700\u65b0\u503c\u4f7f\u7528defer()\u5f02\u6b65\u4efb\u52a1\u4f7f\u7528\u5b9a\u65f6\u4efb\u52a1\u4f7f\u7528interval()\u6216timer()\u5b8c\u5168\u81ea\u5b9a\u4e49\u6d41\u7a0b\u4f7f\u7528create()\u6700\u4f73\u5b9e\u8df5\u63d0\u793a\u5728Android\u4e2d\u59cb\u7ec8\u8003\u8651\u751f\u547d\u5468\u671f\u7ba1\u7406\uff0c\u907f\u514d\u5185\u5b58\u6cc4\u6f0f\u5408\u7406\u4f7f\u7528\u7ebf\u7a0b\u8c03\u5ea6\u5668\uff0c\u907f\u514d\u4e3b\u7ebf\u7a0b\u963b\u585e\u5bf9\u4e8e\u53ef\u80fd\u4ea7\u751f\u5927\u91cf\u6570\u636e\u7684\u573a\u666f\uff0c\u8003\u8651\u4f7f\u7528Flowable\u5904\u7406\u80cc\u538b\u590d\u6742\u7684\u521b\u5efa\u903b\u8f91\u53ef\u4ee5\u5c01\u88c5\u4e3a\u53ef\u590d\u7528\u7684\u65b9\u6cd5\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/56638.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-14T13:24:57+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/56638.html","url":"https:\/\/www.wsisp.com\/helps\/56638.html","name":"RxJava Android \u521b\u5efa\u64cd\u4f5c\u7b26\u5b9e\u6218\uff1a\u4ece\u6570\u636e\u6e90\u5230Observable - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-14T13:24:57+00:00","dateModified":"2025-08-14T13:24:57+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/56638.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/56638.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/56638.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"RxJava Android \u521b\u5efa\u64cd\u4f5c\u7b26\u5b9e\u6218\uff1a\u4ece\u6570\u636e\u6e90\u5230Observable"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/56638","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=56638"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/56638\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=56638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=56638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=56638"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=56638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}