Grokking Android

Getting Down to the Nitty Gritty of Android Development

Posts tagged “Android”:

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”

How to Correctly Store App-Specific Files in Android

By

Christophe Versieux (Waza_be) posted a rant about android developers’ bad habit to store files directly on the root of the sd card. I completely agree with the post. It’s bad usage to create app-specific folders directly at the root. If you install a lot of apps, the sd card’s root gets cluttered fast. One comment […]  Continue Reading  “How to Correctly Store App-Specific Files in Android”

Android Quick Tip: Formatting Text with Html.fromHtml()

By

Android offers you the possibility to easily format text with HTML markup. Thus it’s easy to create text like this: You probably are going to use bold or italics the most, but there are many more supported. Here is the list of all supported tags. You can find it in the source of android.text.Html’s inner […]  Continue Reading  “Android Quick Tip: Formatting Text with Html.fromHtml()”

Android Tutorial: BroadcastReceiver

By

Whenever you want to know about system wide events you need to implement and register a BroadcastReceiver. From then on your receiver gets notifications whenever the system event, for which it is registered, occurs. BroadcastReceivers are one of Android’s four standard components. What are BroadcastReceivers good for? The fact that Android informs you about system […]  Continue Reading  “Android Tutorial: BroadcastReceiver”

Wrapping Your Head Around Android’s Plurals

By

Android has this nice feature to make your handling of strings with numbers easy. If you want to display slightly different messages that depend on how many items a user has selected, you can use Android’s plurals element in your strings.xml: Of course you have to use this string somewhere in your code and you […]  Continue Reading  “Wrapping Your Head Around Android’s Plurals”

Handling Binary Data with ContentProviders

By

To share binary data across app boundaries Android’s programming model expects you to use content providers. And while I have covered how to access content providers and how to code one yourself, I haven’t covered how to deal with binary data. I am going to correct that in this post. How to access binary data […]  Continue Reading  “Handling Binary Data with ContentProviders”

Checking Intent Availability in Android

By

Intents are probably Android’s most powerful tool. They tie together loosely coupled components and make it possible to start Activities that are not part of your own app. Using intents you can delegate to the Contacts app to select a contact or you can start the browser, share data and so on. The receiving apps […]  Continue Reading  “Checking Intent Availability in Android”

Android’s ContentProviderOperation: “withYieldAllowed” explained

By

Whenever you use a ContentProviderOperation and have to insert, update or delete many records, the method withYieldAllowed() comes in handy. Normally the batch job would be executed in one transaction that spans all operations. But if your job contains many manipulations, the transaction might last quite a while and it might block other tasks from […]  Continue Reading  “Android’s ContentProviderOperation: “withYieldAllowed” explained”

Android Tutorial: Adding Search to Your Apps

By

Search on Android is a big topic. On every device’s homescreen is the Quick Search Box by default, older devices even had a dedicated search button. With the Quick Search Box you can quickly search the web, search for apps or contacts and search within all apps that are configured for global search. Many apps […]  Continue Reading  “Android Tutorial: Adding Search to Your Apps”

Why is There no Configuration by Default for Android Search?

By

If you use Android search a lot you will have noticed that you write the same lines of code again and again. You have to configure two things to make Android’s search work: the meta-data to use for search and which Activity to use for search Coming from the Java EE world, this reminds me […]  Continue Reading  “Why is There no Configuration by Default for Android Search?”