Testing your HTTP requests offline
Nov 22, 2016
Most apps have to talk with servers in some ways and testing is not always easy. There are multiple steps involved to set up the test data, and sometimes a specific request can only be triggered once. Whatever the reason, often there is some work involved to test even the most basic things. So why not just cut out the server and provide your own data?
You might even get something like a demo or offline mode in the process.
Working with multiple flavors and build variants
Nov 9, 2016
Flavors enable you to have multiple similar versions of your app within a single code base, like different colors, or the common example of a paid and a free version of the same app. They greatly increase maintainability, as well as publishing updates to multiple apps gets significantly easier. But while having different settings for every flavor is simple enough, things start to get really tricky if you introduce flavor dimensions and find yourself dependent on combinations of different flavors and build types.
Let’s assume I have a news and a blog app. Both could be some sort of RSS reader and they share the same code base. I also have a development and a production environment, because I don’t always test my code, but when I do, I test it in development! :)
The basic setup is simple and I define my flavor dimensions as well as my flavors. Because I actually have two different apps, each one has it’s own unique
Now that things are set up I want to go ahead and add the URLs to my server and this is where things get complicated.
Since I have two apps each app has its own URLs, one for development, and one for production.
Create custom layouts
Sep 18, 2016
More often than not you will find yourself in a position where you need some…custom behavior. Whether you want a view to keep a 16:9 aspect ratio, or want a view to scroll—and still fill the screen.
Don’t be afraid to create and use your own layouts. Not only will they have great reusability, they will save you time and ease your life. If you start repeating the same pattern in your layout files…maybe you should just create a custom View. Your layout will stay clean and simple while you have better maintainability when something changes.
Most important of all: If you like using
ViewTreeObserver to adjust your layouts drop everything right now. This post is for you.
Aug 18, 2016
If you feel like generating your own source code there is little information available on how to start or where to begin. In this post I want to offer some introduction into Java annotation processors, how to generate source code, and—most importantly—how to test it.
For the sake of this guide I just want to stub out a simple interface.
Yea…this should not be too hard…and who does not like tea?
Retrofit 2, converters and unwrapping json objects with RxJava
Jul 12, 2016
My two cents on how to deal with wrapped json objects by using Retrofit converters
I’m sure everyone has had the joy of dealing with wrapped objects in json. The best part of them is that you get to check for errors 3 times:
isSuccessful, and the response’s custom result code, if you were to use the default
Call<> object provided by Retrofit 2.
Basics for views and how to create your own
Jul 10, 2016
What is a view? Why would I create my own? and…how does it work?
If you don’t know whether you need a custom view or not, you probably don’t. Most UI elements can be easily expressed using the elements of the Android framework, the support library, or the Google design library.
If you still did not find what you were looking for try GitHub first. Especially for Android there are thousands of libraries, some of them might do what you want. And now that you still didn’t find anything that you can or want to use, because your usecase is very special in some way…Now I have to admit: You probably need a custom view.
Settling in with Firebase Analytics
Jun 12, 2016
You might have heard: Firebase is the new thing. It is here, it is awesome, and I believe it will make all of our lives somewhat easier.
If you decide to switch to Firebase you will end up using analytics within your app. The default reports alone are worth the few steps it takes to set it all up. Tracking events has never been easier and I am hooked, although, to me, Firebase Analytics seems more like something that I want to use in addition to Google Analytics. While Firebase helps me to get my app up and running, Google Analytics still shares some valuable insights.
Dagger 2 Basics
May 4, 2016
Dagger 2 can be confusing. This shall shed some light on the key concepts and highlight their proper use. You could start by reading the User’s Guide to acquire the general and official knowledge, and once you have brewed your coffee, pray, continue.