Skip to content

Instantly share code, notes, and snippets.

tslamic /
Last active Apr 11, 2018
Abstracting APIs

Abstracting APIs

Assume you're developing an XKCD comic browser on Android. The API offers two endpoints:

There are numerous ways to access the above endpoints: either with libraries such as Retrofit, Volley, Ion, or manually, using e.g. HttpURLConnectionand AsyncTasks, Services, Loaders or other building blocks offered by the SDK.

With constant improvements, best practices and new libraries, it's good to not be tied to a particular implementation

tslamic / DeviceNames.bytecode
Created Aug 22, 2015
Potential implementations for AndroidDeviceNames. See for more info.
View DeviceNames.bytecode
Compiled from ""
public final class io.github.tslamic.adntest.DeviceNames {
public static java.lang.String getCurrentDeviceName(java.lang.String);
0: getstatic #1 // Field android/os/Build.MODEL:Ljava/lang/String;
3: aload_0
4: invokestatic #2 // Method getDeviceName:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
7: areturn
public static java.lang.String getDeviceName(java.lang.String, java.lang.String);