From the course: Android App Development: Design Patterns for Mobile Architecture

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Add binding with RxJava, part 1

Add binding with RxJava, part 1 - Android Tutorial

From the course: Android App Development: Design Patterns for Mobile Architecture

Start my 1-month free trial

Add binding with RxJava, part 1

- [Instructor] The first step that we're going to do is to go into our model layer. In this case we'll add it onto the interface. And we're going to say SpyDTO. We'll just say spyForName. Pass in the string and return to name and then also we're going to say save a list of spyDTOs, and this is so we can persist it into the database by handing out the specific list as opposed to loading from the network and saving only in that manner. Dtos, and then we'll say an Action finished. And now, coming in here, we just need to implement those. So spyForName, we're just going to say, we're going to get a spy from the database. DataLayer.spyforName, which doesn't exist yet, and we'll create it in a moment. Create that method. We'll implement that method. And then in the database I'll just say realm.where, Spy.class, .equalTo, the name field. Pass in name, and then findFirst, and then we'll return realm.copy, and we'll end at that spy, call this tempSpy. And we'll extract a variable here. And…

Contents