Small pieces of code that can be copy/paste-ed on your project
Android Show HTML Bulleted List from strings.xml
If you search on the internet about how to show a bulleted list from strings.xml using HTML tags, most of the answers will say that you should use a WebView,…
Read More How to get current flavor from gradle
Figuring out how to pull the current flavor from gradle While working on an update for one of our games, I needed to figure out how to get the current…
Read More Generate random number between 2 numbers
The following snippet will help you generate a random number in Java that is between 2 numbers (min and max). static Random random = new Random(); /** * Min is…
Read More Get screen size
So if you ever need to get screen size in width and height on Android, you can use the following snippet: /** * Returns the size of the screen in…
Read More 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…
Read More 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…
Read More Add links to a TextView in Android
Maybe you need to add links to a TextView on Android but you don’t want to use Linkify for some reasons and you also want that link to be opened when…
Read More Android: How To Change Hint’s Size
If you need to set a smaller hint for your edit text, you can set the hint this way: myEditText.setHint(Html.fromHtml( "<small><small><small>" + getString(R.string.hint) + "</small></small></small>")); Also, you can set the…
Read More