If you haven’t seen Google’s architecture, you can learn more about it here. Also, if you’re not familiar with ObjectBox, check out this post.


The goal with the architecture is to end up with something like this:

If you’re familiar with libraries like greenDAO or EventBus, you may have heard of the company that created them: greenrobot. If not, I recommend checking them out. In short, they build high quality open source libraries for app developers.

Recently, they have come out with a new library called ObjectBox. It is used to help manage your app’s local data storage. Their older library greenDAO serves the same purpose, but ObjectBox is their next step in local storage solutions. The biggest difference is that ObjectBox does not use SQL at all.

Getting Started

To get started using it, you can check out…

If you’re familiar with RelativeLayout, then ConstraintLayout should feel similar to you. ConstraintLayout has much more flexibility though, and performs better than the RelativeLayout. In general, you should always use ConstraintLayout over RelativeLayout.

To add ConstraintLayout to your project, place the following in your build.gradle files:

Before we look at an example of ConstraintLayout, let’s look at an example using RelativeLayout. I want to have a layout that looks like this:

At Google I/O this year, Google announced a new set of architecture libraries. One of the new components they included is called LiveData. It can be used to help manage propagating data to your views, while respecting the Activity and Fragment lifecycles. Until now, you typically had to manage all of this on your own. Or more commonly, many developers neglected to handle these scenarios at all. This resulted in memory leaks, among other issues.

In the past, I wrote about how to make an event bus with RxJava. I also wrote about how you could send events without the…

Do you have an idea for a new website, app, game, etc.? There are a few things you should consider before dedicating the next few years of your life to it.

If you spend a significant amount of time on anything, you may start to feel like it has some inherent value because of that time. Well, it doesn’t. This is known as the sunk cost fallacy. You can’t get your time back, so you feel the need to justify its value. Whether you spent one year or one day on it, the end result is all that matters.


To get started you need to include the following in your build.gradle file:

Now you can set up your API interface with RxJava Observables, for example:

As you can see above, I can use my own data model and the JSON response will be converted automatically. I can also simply get a JsonObject if I just want to use the JSON myself.

Alternatively, I can set up my own deserializer, like so:

Lastly, here is my API creation with a deserializer for the User added in:

There are many different ways you can use Retrofit, RxJava

It’s human nature to compare yourself to others. Everybody does it. The problem is that many of us misunderstand what we’re comparing.

For example, you’re looking at Facebook and see that your friend got a new high paying job. This person is the same age as you, but you know they are making significantly more money than you. Why aren’t you doing that well? You may feel like you’ve fallen behind, or that something has gone wrong in your life.

Yet, consider this: you and your friend are different people. You live completely different lives. It’s not as if your…

Another year, another Google IO conference. As usual, there were some interesting announcements regarding Android. As I was watching the conference, I made a list of things I wanted to try out or learn more about.


Having hung out in various Android communities, Kotlin has been something I’ve seen come up more and more frequently lately. I’ve been mostly avoiding it, because it seemed like a fad. Now that I know it’s not going anywhere, and is supported by Google, I feel like I need to give it a shot. …

Your life is made up of a series of choices. For many of us, having a choice means that there are right and wrong answers. But I don’t think that’s true.

When I was in university, at the end of my third year of a four year program, I had the option to take an extra year to do an internship. I had the choice to either take the extra year or finish my degree earlier. There are benefits and negatives to each option that I considered, and I chose to do an internship. I’ll never know what would have…

Let’s take a look at a sample AsyncTask. It will make a network request to a URL and then return whether or not it was successful. For this example I’m using OkHttp, but that part isn’t important.

If you’ve used an AsyncTask before this code should look familiar. Inside the doInBackground method I make a network request to some given URL, and return the result as a Boolean. Then in onPostExecute I could do something with that result.

Now if I want to remove the AsyncTask and replace it with RxJava (and Retrolambda), one solution would look like this:

Pierce Zaifman

Freelance Android app developer | I love productivity, creativity, and finding balance | Email me for a quote at pierce@piercezaifman.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store