January 2015

Uncategorized

Android Studio Tip #2 – Extract Instance Variable

You might need to “convert” a local variable into an instance variable. Well, you can do this very easy with Android Studio. So, in order to extract an instance variable (field) you can do this by using the following shortcut: CTRL + ALT + F (on Windows) or Cmd + ALT + F (on Mac OS)

, , , ,
Uncategorized

Android Studio Tip #1 – Extract Constants

If you have hardcoded strings that should be extracted into constants, you can do that in at least 2 ways: the hard way the EASY way The hard way  is to write yourself the constant and then replace it in the entire code where the string is used. And the EASY way  is to use the power

, , , ,
Solutions, Tutorial

Load localized strings at runtime

Here is a possible solution if you want to load localized text resources on a TextView in Android. Problem: You may need to extend your app flexibility to be able to load localized texts at runtime from a web server for example. That would be to be able to add new localizations (for new countries)

, , , , , , , ,
Snippets, Solutions

How to unzip Gzipped InputStream

If you are working with HttpURLConnection on Android then you might encounter strange InputStream outputs like when you have a strange character encoding even though on the server side everything seems ok. A problem I was encountered lately was when I needed to parse a RSS/Atom feed on Android. I was getting the following error:

, , , ,
Snippets, Solutions

Print Android signing key SHA in code

If you ever want to get the Android SHA (1/256), MD5 or the signing key used to sign your app for example you can use the following snippet. Important! Be aware that you should not print that in a production environment as it might leak sensitive data API 28> (Kotlin) Deprecated (Java) And the converter

, , , , , , , ,
Solutions, Tutorial

Make Genymotion point to localhost

I had a lot of fights with this and I think it’s better to write down the solution so I won’t waste my time looking again on google/stackoverflow for it. Maybe this will help you too! Problem You might have a local webservice or something on your machine that needs to be accessed from a

, , , , ,
Tutorial

Android Floating Action Button (FAB) Tutorial

TUTORIAL DEPRECATED Use this tutorial instead: Floating Action Button New In this tutorial I will show you how to add a Floating Action Button aka FAB, for pre Lollipop versions and for Lollipop. For pre versions it will be just a simple round button with shadow and click effect, but for Android 5.0 we will use

, , , ,
Scroll to Top