All snippets tagged with android

Page 6 of 7
 

Custom TestRunner

Using the clipboard

Camera2 implementation in an extendable Fragment

If you’re going to add a custom camera to your app, use these snippets to do it right. This recipe uses the Camera2 APIs, and hides all the weird code required for setting up a viewfinder and taking pictures.

Read more…

Barcode scanner using Google Vision

Absent live data

Vibration and haptic feedback

Showing notifications

Get the SHA of a keystore

Gets the MD5, SHA1 and SHA256 of a keystore. You’ll need this for many signin solutions, such as Google SignIn, Facebook, Twitter, etc.

Read more…

FragmentActivity

Okhttp 401 handler

Handle session expirations and 401 error codes. The following code will be activated if the API responds with a 401 (no authentication). If there’s a token that should be renewed, we first renew the token and if this is successful we try the original request again.

Read more…

Using local JSON files as an API placeholder with Retrofit

With this snippet you can easily and quickly mock an API during developmentby placing JSON files in your res/raw/ folder. This comes in handy when the actual API does not exist yet.

Read more…

Pagination

A very complete recipe that implements a RecyclerView that pulls in paginated data, using Retrofit, LiveData. It includes example models, adapter, viewholders, and a viewholder for displaying the network state in case of an error.

Read more…

Centralized error handling

Pair emulator Android Wear with real phone

Install app as a system app on the emulator