Easy Android Preferences with Bulldog. No more boilerplate code !

Sérgio Serra
Oct 22, 2018 · 1 min read

Never write code like this anymore

or this

all over you code base.


Bulldog uses annotation processing and Kotlin delegated properties to simplify reading and storing values in Android preferences.

With Bulldog we can read and write values just like a normal object

But how does it works ?

1- First import dependencies in build.gradle

2- Init BulldogContext in App class.

3- Define your model using an object annotated with @Bulldog, here you can also set default values for each property.

4- Bulldog will generate a classe at compile time with the name UserSettings. Use this class to read and store values, under the hood is uses Android preferences to store and retrieve values.

Generated class contains a clearXXX() method for each property and a human readable toString() implementation.

Read values

Just access object property like a normal object.

Write values

Clear values

Bulldog generates a clear method for each entry.

Print information

Bulldog also generates a toString() human readable implementation.

Enum support

Bulldog supports Enum type using the @Enum annotation.

For more info take a look at:

Thanks that’s all !!!

Sérgio Serra @Android Developer

sergioserra99@gmail.com

Sérgio Serra

Written by

Android Enthusiast, Mobile developer, UI/UX fan, like to great user experiences.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade