Android Random Perfomance Tip: Replace Enums

Enums on Android might require more than twice the memory as compared to static constants.
Replace enums in your code with static constants. The Android support annotations provide some useful annotations to help you catch bugs and check that you’re using the expected values for your static constants just like enums would , without the overhead.

Android Tint Drawables

Instead of adding multiple image assets that differ only in color to your androd project. Use only 1 asset and use TintDrawables to change the color.  e.g.:

public static void setImageColor(ImageView image,int color){
DrawableCompat.setTint(image.getDrawable(), color);

see the below gist for an example:
[2], int)

Random Android Gradle Tip: App dependencies

If you need to see the dependency tree for your project you can run:
./gradlew :app:dependencies
./gradlew :app:androidDependencies
if you need to solve a conflict you could either exclude the conflicting module or use a resolution strategy to force a particular version of the library to be used .


Android TV Dialog

The leanback library for Android TV introduced the concept of guided step fragments. These have an intuitive way of presenting prompts to a user. I made a simple class that uses a GuidedStepFragment to create a simple yes/no dialog for TV. check out the git repo below


Native Dialog

TV dialog:

TV Dialog

I made the news!!… well my app did

Android Central wrote an article about my workout app,  365 Body Workout.

You should try it out 🙂