How to Train your `droid`?

Garima Jain
Feb 25, 2017 · 7 min read

Hello droid!

If you are looking for a technical training kind of an article, you have come to the wrong place then :). I am writing this to share a few “things” about Android that I have experienced / heard, so that we can all have some fun time while our gradle builds are running or while we are sipping a cup of tea or maybe in the middle of a boring meeting.

WARNING!

Kindly read at your own risk. Don’t miss the Damage-control links!

Let’s begin! Shall we?

A for Activity. Activity in android is one of the main components. Almost every application contains at least one Activity.

“Best way to prevent your Activity from getting restarted on orientation change is to set `android:configChanges` and just forgetting about it.”

“Broadcast Receiver’s onReceive() is your stage. Go wild here and perform all the long running tasks.”

“Creating a ContentProvider for your application is a MUST for you. You don’t seem to have a life anyway.”

No-body cares about your Alarms, your Wake-locks, your sync jobs or even your app. Why should you?”

“Best way to have elevation in your apps is to just use setElevation() function and a get a super-ugly flat UI on pre-lollipop devices. Deal With It!”

“Start by Realtime Database to cache all your data. Upgrade to FCM or your phone might not wake up once it dozes off. Firebase all the things!”

“I love Gradle! It makes our life full of power-naps and TT.”

Animation not running? Keyboard not showing up? width/ height is 0? Do the magical handler.postDelayed() and you are good! Yeah go ahead and pat your back.

Image for post
Image for post
Well Done Source

I for Intent. Intent is the intention to perform a certain action. It can be Explicit (Direct — Authoritatively announce to perform an action like an extrovert) or Implicit (Indirect — First give a signal regarding your intention and perform an action when invited like an introvert).

“Feeling too Lazy to implement a feature? Throw an Intent and just let other apps handle it!”

“Damn! WORA — Write Once Regret Always”

“I once wrote an Application in Kotlin. Code | Convert Java File to Kotlin File.”

L -> {Lambda Expressions}. Less formal and more readable expressions.

“I like verbose.”

“Let’s make our lives a living hell and drown in the ocean of unlimited classes and interfaces.”

Image for post
Image for post
Source

O for OkJesse. Jesse Wilson, developer at Square told in one of the Fragmented Podcasts about the reason behind naming the libraries as OkHttp, OkIO. It’s because OK is a moment to rejoice for all of us :

“We, Developers live to get a 200 OK from the API. Always”

“Lazy to complete a task? Pass it to another application as a pending intent instead.”

Select * from PJs WHERE name like ‘Q%’ ;

0 results found.

“I love MAGIC! But with great POWER comes MissingBackpressureException”

“Service runs in background, Go Ahead and do all your ugly stuff here and die in the hands of ANR.”

“Let’s aim for 100% test coverage and make the client pay for it.”

“Even after ~ 4 years of Android Development I do not fully understand the concept of URI myself. You can safely skip this section.”

“Custom Views are so cool, let’s always draw our views ourselves.”

Image for post
Image for post

W for Wharton, Jake Wharton. He is the GeekGod of Android who works at Square. He has given us “things” like ButterKnife, Dagger, Retrofit, Timber, Hugo etc.

“Applications respond to Chuck Wharton even in the case of ANR.”

“Let’s use the cool new ConstraintLayout. It can be created using the Layout Editor, no need to work with stupid xmls anymore. … 4 hours later…. *creates a LinearLayout using xml*.”

“After this rigorous training you have become the Master of Android Things.”

Image for post
Image for post
Master of Things Source

Z for zzz. All work and no “Zzz” makes droid a dull “thing”.

“While you were reading this article, your device probably dozed off and your dear app won’t be able to do any damn thing about it!”

TL;DR

You missed all the good stuff. No issues, go back to stare at your “Gradle Build Running” dialog then :P

This post was partially inspired by @anddev_badvice on Twitter and title from “How to Train your Dragon” movie which is pretty awesome!

I you are not already sick of these ultimate PJs or maybe want to read something a little less lame maybe, then checkout a similar article on iOS Development — “How to be good at Bad iOS Development” by Ritesh Gupta

I am myself a droid who is still learning. If you think I made a mistake anywhere, or you seek an explanation to the silly stuff in this post, leave a response. Click the heart if you want your fellow droids to chill a little too.

Image for post
Image for post

BAZINGA!

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

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