Grokking Android

Getting Down to the Nitty Gritty of Android Development

How to Use Loaders in Android

By

With the introduction of Honeycomb Loaders became the preferred way to access data of databases or content providers. They load data asynchronously and notify listeners when the results are ready. Google did not only introduce Loaders but also deprecated the previous way to handle a Cursor within your activities. You shouldn’t use startManagingCursor() or managedQuery() […]  Continue Reading  “How to Use Loaders in Android”

Android Quick Tip: Enabling and Disabling BroadcastReceivers at Runtime

By

BroadcastReceivers are good when you want to be notified about system events. But sometimes you do need to know about an event only once or for a short period of time. A dynamically registered receiver doesn’t cut it because the Activity and it’s dynamically registered broadcast receiver might long be dead when the event occurs. […]  Continue Reading  “Android Quick Tip: Enabling and Disabling BroadcastReceivers at Runtime”

Recording Audio using Android’s MediaRecorder Framework

By

Sometimes your app needs the ability to record and store audio files. As most devices come with a microphone it’s no surprise that Android offers app developers the possibility to do so. This post deals with the two most common ways to record audio on Android. Recording audio using an Intent As usual that’s by […]  Continue Reading  “Recording Audio using Android’s MediaRecorder Framework”

Adding Files to Android’s Media Library Using the MediaScanner

By

When you add files to Android’s filesystem these files are not picked up by the MedaScanner automatically. But often they should be. As far as I can tell from a cursory search through Android’s codebase, Android runs a full media scan only on reboot and when (re)mounting the sd card. This might sound bad at […]  Continue Reading  “Adding Files to Android’s Media Library Using the MediaScanner”