Tag: Handler

How to know if your Android App is in background

The Android framework does not provide an easy way to detect if an App has gone into background. While it's really easy to know if an activity is visible or not with it's onStart() / onStop() methods, this does not really tell us much about our application state. Think this, you may want to be … Continue reading How to know if your Android App is in background

Android Snippet. How to quickly run code on the main thread

Here's a simple code snippet that enables you to run a Runnable object on the main thread, or UI thread. This is very handy if you have to update your UI from a background thread or an AsyncTask. It does not require something in particular, this code can be run from everywhere inside your application: … Continue reading Android Snippet. How to quickly run code on the main thread