{"id":4532,"date":"2019-05-09T12:46:26","date_gmt":"2019-05-09T07:16:26","guid":{"rendered":"https:\/\/blog.pheonixsolutions.com\/?p=4532"},"modified":"2019-05-09T16:27:55","modified_gmt":"2019-05-09T10:57:55","slug":"how-to-use-rx-java-with-room-in-android","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/","title":{"rendered":"How to use Rx-java with Room in android"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">How to use Rx-java with Room in android<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">Date : 08\/04\/2019<\/h4>\n\n\n\n<h3 class=\"wp-block-heading\">Prerequisite<\/h3>\n\n\n\n<p>If you need to use Rx-java in android, then add the following dependency in your gradle file as depend on the version of Rx-java you use.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ RxJava support for Room<br>implementation \u201candroid.arch.persistence.room:rxjava2:1.0.0-alpha5\u201d<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Need of Rx-java<\/h3>\n\n\n\n<p>Rx-java eliminates the boiler plate codes in java programming. It will make the program more readable. Another benefit is it will eliminate the task on separate threads and it write codes. Schedulers will take responsibility for running the tasks. Rx-java performs asynchronous calls to room. Some fundamental types of task are perform in room database as below.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Insert <\/h3>\n\n\n\n<p>Room integration with Rx-java allows the corresponding returns types.<\/p>\n\n\n\n<p>1. completable &#8211; onComplete = as soon as insertion is done.<\/p>\n\n\n\n<p>2. Single&lt;long&gt; or maybe&lt;long&gt;  =  where the value is emitted on onSuccess() which returns the row id in database.<\/p>\n\n\n\n<p>3. Single&lt;List&lt;long&gt;&gt; or maybe&lt;List&lt;long&gt;&gt; =  where the value is emitted on onSuccess() which returns the list of row id in database.<\/p>\n\n\n\n<p>4. If error occur on inserting values in room the database, Maybe, Completable, Single  all will emit the Exception in onError(). One the usage of Rx-java in room query attached here.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"389\" height=\"154\" src=\"https:\/\/blog.pheonixsolutions.com\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-09-21.png\" alt=\"\" class=\"wp-image-4535\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-09-21.png 389w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-09-21-300x119.png 300w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/figure>\n\n\n\n<p>Use observeOn() to specify Scheduler on which the observer will observe the items emitted. Use subscribeOn() to specify Scheduler on which the observable operates.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Update\/Delete<\/h3>\n\n\n\n<p>Room integration with Rx-java returns the corresponding types when update\/delete the Room.<\/p>\n\n\n\n<p>1.completable &#8211; onComplete = as soon as update\/delete is done.<\/p>\n\n\n\n<p>2.Single&lt;Integer&gt; or maybe&lt;Integer&gt; = where the value is emitted on onSuccess() which returns list of row id in database.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"520\" height=\"111\" src=\"https:\/\/blog.pheonixsolutions.com\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-10-50.png\" alt=\"\" class=\"wp-image-4536\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-10-50.png 520w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-10-50-300x64.png 300w\" sizes=\"auto, (max-width: 520px) 100vw, 520px\" \/><\/figure>\n\n\n\n<p>Use the observeOn() operator to specify the Scheduler on which it will observe the Observable and subsribeOn() to specify the Scheduler on which the Observable will operate.<br><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Query<\/h3>\n\n\n\n<p>To get user from the database, we can write the following query in the data access object class.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"574\" height=\"60\" src=\"https:\/\/blog.pheonixsolutions.com\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-12-00.png\" alt=\"\" class=\"wp-image-4538\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-12-00.png 574w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-12-00-300x31.png 300w\" sizes=\"auto, (max-width: 574px) 100vw, 574px\" \/><\/figure>\n\n\n\n<p>The above method has two disadvantages<\/p>\n\n\n\n<p>1. It is synchronous.<\/p>\n\n\n\n<p>2. we have to call it by manually.<\/p>\n\n\n\n<p>Rx-java provide Flowable, Maybe, Single are observes the database and delivers asynchronous results.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"38\" src=\"https:\/\/blog.pheonixsolutions.com\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-12-50.png\" alt=\"\" class=\"wp-image-4539\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-12-50.png 512w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-12-50-300x22.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/figure>\n\n\n\n<p>And it will keeps you out of Main thread. It also has a Scheduler to run every operation. It is your decision to mention the thread on observeOn().<\/p>\n\n\n\n<p>For queries that returns maybe or single then make sure that you are calling subsribeOn() other than AndroiodSchedulers.mainThread().<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Maybe<\/h3>\n\n\n\n<p>Here\u2019s what happens:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"38\" src=\"https:\/\/blog.pheonixsolutions.com\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-12-50-1.png\" alt=\"\" class=\"wp-image-4540\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-12-50-1.png 512w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-12-50-1-300x22.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><li>When there is&nbsp;<strong>no user in database<\/strong> then query returns no rows, Maybe will <strong>complete<\/strong>.<\/li><li>When there is&nbsp;<strong>an user in  database<\/strong>, then Maybe will trigger onSuccess() and it will complete.<\/li><li>If the&nbsp;<strong>user is updated<\/strong> after Maybe was completed, <strong>nothing happens<\/strong>.<\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Single<\/h3>\n\n\n\n<p>Here are some scenarios:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>When there is&nbsp;<strong>no user in database<\/strong> then the query returns no rows, Single will trigger 0nError().<\/li><li>When there is<strong> an user in the database<\/strong>, Single will trigger onSuccess().<\/li><li>If the&nbsp;<strong>user is updated<\/strong> after Single was completed, <strong>nothing happens<\/strong>.<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"517\" height=\"50\" src=\"https:\/\/blog.pheonixsolutions.com\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-13-11.png\" alt=\"\" class=\"wp-image-4541\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-13-11.png 517w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-13-11-300x29.png 300w\" sizes=\"auto, (max-width: 517px) 100vw, 517px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Flowable\/Observable<\/h3>\n\n\n\n<p>Here\u2019s how the Fowable\/Observable behaves:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>When there is&nbsp;<strong>no user in the database<\/strong>, then query returns no rows, the Flowable<strong> will not emit  anything.<\/strong><\/li><li>When there is&nbsp;<strong>an user in database<\/strong>, then Flowable will trigger <code><strong>onNext<\/strong><\/code>.<\/li><li>At every time the <strong>user data is updated<\/strong>, then Flowable object will <strong>emit automatically<\/strong>, and allowing you to update the UI based on the latest data.<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"491\" height=\"53\" src=\"https:\/\/blog.pheonixsolutions.com\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-13-29-1.png\" alt=\"\" class=\"wp-image-4542\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-13-29-1.png 491w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-13-29-1-300x32.png 300w\" sizes=\"auto, (max-width: 491px) 100vw, 491px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Conclusion<\/h3>\n\n\n\n<p>Rx-java will also assist you to testing the code. Hopefully in future,we will write about this.<\/p>\n\n\n\n<p>Thank you for using <a href=\"https:\/\/pheonixsolutions.com\/\">pheonix solutions<\/a>. <\/p>\n\n\n\n<p>If  You find this tutorial helpful? Share with your friends to keep it alive. .If you have doubts, feel free to leave a comment.<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to use Rx-java with Room in android Date : 08\/04\/2019 Prerequisite If you need to use Rx-java in android, then add the following dependency in your gradle file as depend on the version of Rx-java you use. \/\/ RxJava support for Roomimplementation \u201candroid.arch.persistence.room:rxjava2:1.0.0-alpha5\u201d Need of Rx-java Rx-java eliminates the&hellip; <a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/\" class=\"more-link read-more\" rel=\"bookmark\">Continue Reading <span class=\"screen-reader-text\">How to use Rx-java with Room in android<\/span><i class=\"fa fa-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[570,386],"tags":[569,647,646],"class_list":{"0":"post-4532","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-android-development","7":"category-database","8":"tag-android","9":"tag-room","10":"tag-rx-java","11":"h-entry","13":"h-as-article"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pheonix Solutions - We Empower Your Business Growth<\/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:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pheonix Solutions - We Empower Your Business Growth\" \/>\n<meta property=\"og:description\" content=\"How to use Rx-java with Room in android Date : 08\/04\/2019 Prerequisite If you need to use Rx-java in android, then add the following dependency in your gradle file as depend on the version of Rx-java you use. \/\/ RxJava support for Roomimplementation \u201candroid.arch.persistence.room:rxjava2:1.0.0-alpha5\u201d Need of Rx-java Rx-java eliminates the&hellip; Continue Reading How to use Rx-java with Room in android\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/\" \/>\n<meta property=\"og:site_name\" content=\"PHEONIXSOLUTIONS\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-05-09T07:16:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-09T10:57:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.pheonixsolutions.com\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-09-21.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:site\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-use-rx-java-with-room-in-android\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-use-rx-java-with-room-in-android\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/0ffa33d73c869faec2d50e79c24e3503\"},\"headline\":\"How to use Rx-java with Room in android\",\"datePublished\":\"2019-05-09T07:16:26+00:00\",\"dateModified\":\"2019-05-09T10:57:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-use-rx-java-with-room-in-android\\\/\"},\"wordCount\":614,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-use-rx-java-with-room-in-android\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.pheonixsolutions.com\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/Screenshot-from-2019-05-09-09-09-21.png\",\"keywords\":[\"Android\",\"ROOM\",\"Rx-java\"],\"articleSection\":[\"Android development\",\"Database\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-use-rx-java-with-room-in-android\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-use-rx-java-with-room-in-android\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-use-rx-java-with-room-in-android\\\/\",\"name\":\"Pheonix Solutions - We Empower Your Business Growth\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-use-rx-java-with-room-in-android\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-use-rx-java-with-room-in-android\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.pheonixsolutions.com\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/Screenshot-from-2019-05-09-09-09-21.png\",\"datePublished\":\"2019-05-09T07:16:26+00:00\",\"dateModified\":\"2019-05-09T10:57:55+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-use-rx-java-with-room-in-android\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-use-rx-java-with-room-in-android\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-use-rx-java-with-room-in-android\\\/#primaryimage\",\"url\":\"https:\\\/\\\/blog.pheonixsolutions.com\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/Screenshot-from-2019-05-09-09-09-21.png\",\"contentUrl\":\"https:\\\/\\\/blog.pheonixsolutions.com\\\/wp-content\\\/uploads\\\/2019\\\/05\\\/Screenshot-from-2019-05-09-09-09-21.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-use-rx-java-with-room-in-android\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use Rx-java with Room in android\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"name\":\"Pheonix Solutions\",\"description\":\"We Empower Your Business Growth\",\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\",\"name\":\"PheonixSolutions\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"width\":454,\"height\":300,\"caption\":\"PheonixSolutions\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/PheonixSolutions-209942982759387\\\/\",\"https:\\\/\\\/x.com\\\/pheonixsolution\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/0ffa33d73c869faec2d50e79c24e3503\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"http:\\\/\\\/blog.pheonixsolutions.com\"],\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pheonix Solutions - We Empower Your Business Growth","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:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/","og_locale":"en_US","og_type":"article","og_title":"Pheonix Solutions - We Empower Your Business Growth","og_description":"How to use Rx-java with Room in android Date : 08\/04\/2019 Prerequisite If you need to use Rx-java in android, then add the following dependency in your gradle file as depend on the version of Rx-java you use. \/\/ RxJava support for Roomimplementation \u201candroid.arch.persistence.room:rxjava2:1.0.0-alpha5\u201d Need of Rx-java Rx-java eliminates the&hellip; Continue Reading How to use Rx-java with Room in android","og_url":"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/","og_site_name":"PHEONIXSOLUTIONS","article_publisher":"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","article_published_time":"2019-05-09T07:16:26+00:00","article_modified_time":"2019-05-09T10:57:55+00:00","og_image":[{"url":"https:\/\/blog.pheonixsolutions.com\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-09-21.png","type":"","width":"","height":""}],"author":"admin","twitter_card":"summary_large_image","twitter_creator":"@pheonixsolution","twitter_site":"@pheonixsolution","twitter_misc":{"Written by":"admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/#article","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/"},"author":{"name":"admin","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/0ffa33d73c869faec2d50e79c24e3503"},"headline":"How to use Rx-java with Room in android","datePublished":"2019-05-09T07:16:26+00:00","dateModified":"2019-05-09T10:57:55+00:00","mainEntityOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/"},"wordCount":614,"commentCount":0,"publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.pheonixsolutions.com\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-09-21.png","keywords":["Android","ROOM","Rx-java"],"articleSection":["Android development","Database"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/","url":"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/","name":"Pheonix Solutions - We Empower Your Business Growth","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/#primaryimage"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.pheonixsolutions.com\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-09-21.png","datePublished":"2019-05-09T07:16:26+00:00","dateModified":"2019-05-09T10:57:55+00:00","breadcrumb":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/#primaryimage","url":"https:\/\/blog.pheonixsolutions.com\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-09-21.png","contentUrl":"https:\/\/blog.pheonixsolutions.com\/wp-content\/uploads\/2019\/05\/Screenshot-from-2019-05-09-09-09-21.png"},{"@type":"BreadcrumbList","@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-use-rx-java-with-room-in-android\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pheonixsolutions.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to use Rx-java with Room in android"}]},{"@type":"WebSite","@id":"https:\/\/pheonixsolutions.com\/blog\/#website","url":"https:\/\/pheonixsolutions.com\/blog\/","name":"Pheonix Solutions","description":"We Empower Your Business Growth","publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pheonixsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/pheonixsolutions.com\/blog\/#organization","name":"PheonixSolutions","url":"https:\/\/pheonixsolutions.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","contentUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","width":454,"height":300,"caption":"PheonixSolutions"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","https:\/\/x.com\/pheonixsolution"]},{"@type":"Person","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/0ffa33d73c869faec2d50e79c24e3503","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","caption":"admin"},"sameAs":["http:\/\/blog.pheonixsolutions.com"],"url":"https:\/\/pheonixsolutions.com\/blog\/author\/admin\/"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7F4uM-1b6","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=4532"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4532\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=4532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=4532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=4532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}