All snippets tagged with java

Page 2 of 3
 

FontUtil - several styling options for text

Simple alert dialog fragment

Checks if a TextView is ellipsized.

Note that this doesn’t just check if the TextView has ellipsizing enabled, it actually checks if the size of the TextView is too short for the full text to appear.

Read more…

Shared element transitions

Circular reveal animation

These are the three steps to show the Material Design circular animation when launching an Activity. Make sure to only use this animation when it makes sense - it is meant to make it clear to the user that a button results in the screen being opened.

Read more…

Play a sound using the MediaPlayer

Important: make mMediaPlayer a field, because otherwise the garbage collector will clean up the mediaplayer while the sound is still playing, causing it to be cut off!

Read more…

Reading and writing files from/to private storage

Simple deeplinking

Rotate a bitmap according to the file's EXIF data

Check if current connection is WiFi

Take a picture using the default camera

Getting the user's location

HtmlCompat for Android Nougat and up

Simple date formatting cheatsheet

Custom TestRunner