Grokking Android

Getting Down to the Nitty Gritty of Android Development

Posts tagged “Android”:

Surprising Statistics on Library Usage in Android Apps

By

AppBrain published statistics on library usage on Android. This list of libraries is very interesting and to me quite surprising. These stats are presented on three tabs: “Ad networks”, “Social SDKs” and “Development tools”. Here I care about development tools only. For example the two most-used libraries are those of the leading analytics providers, Google […]  Continue Reading  “Surprising Statistics on Library Usage in Android Apps”

How Android’s AutoCompleteTextView Nearly Drove me Nuts

By

AutoCompleteTextView is a nice widget Android provides. It helps the user enter text by presenting him possible selections based on what he has entered so far. Nicolas Klein has written a nice introduction of AutoCompleteTextView. As a short recap: You have to provide a ListAdapter that also must implement the Filterable interface. The filterable adapter […]  Continue Reading  “How Android’s AutoCompleteTextView Nearly Drove me Nuts”

Android’s ContentProviderOperation: “withBackReference” explained

By

The class ContentProviderOperation.Builder has a method named withValueBackReference(String key, int previousResult). The API states ominously “Add a ContentValues back reference. A column value from the back references takes precedence over a value specified in withValues(ContentValues)”. Now, thank you, Google! That about explains everything! Android’s documentation is never short of surprises. A lot of stuff is […]  Continue Reading  “Android’s ContentProviderOperation: “withBackReference” explained”

Android Tutorial: Writing your own Content Provider

By

This is the last part of a three part tutorial on content providers. In this post I am going to show you how to write your own content provider. I covered the common concepts of content providers in my first post of this series. And in the second part I’ve covered how to use content […]  Continue Reading  “Android Tutorial: Writing your own Content Provider”

Weird error message in Android’s MergeCursor

By

For an app I am working on I needed a MergeCursor to use search in a meaningful way. I needed to use two combine two cursors from different sources and I was going to merge them. The only major difference between the code for both cursors was the projection map I used to transform the […]  Continue Reading  “Weird error message in Android’s MergeCursor”

Android: Getting Notified of Connectivity Changes

By

In a previous posting I have explained how you can check the device’s current connectivity status. But this is only a temporary snapshot of the status. It might change anytime – and it probably will, given the volatility of a mobile environment. Thus you want to know whenever the connectivity state changes. Thankfully Android’s ConnectivityManager […]  Continue Reading  “Android: Getting Notified of Connectivity Changes”

Displaying Error Hints in Forms on Android

By

Displaying error messages in forms on Android is really simple. Most widgets have a setError(CharSequence text) method that can be used to indicate problems. Say you have a form where you have to enter a product. Now while entering more data into the form the app might check the product number and some backend service […]  Continue Reading  “Displaying Error Hints in Forms on Android”

Android Tutorial: Using Content Providers

By

In this tutorial I am going to show you how to make use of existing content providers. It’s the second part of a three part tutorial on content providers. In the first part I covered the common concepts of content providers and in the next part I am going to deal with how to write […]  Continue Reading  “Android Tutorial: Using Content Providers”

Finding all View-IDs of an Android UI

By

Recently I stumbled upon a NullPointerException caused by using findViewById(R.id.whatever) which returned null for this id. But the id was in the layout file. And I didn’t change the layout programmatically. Furthermore other widgets were found without any problem. Hmm – what’s going on? To analyze the problem I thought about a way to find […]  Continue Reading  “Finding all View-IDs of an Android UI”

Android: Better Performance with ContentProviderOperation

By

ContentProviders are one of Android’s core building blocks. They represent a relational interface to data – either in databases or (cached) data from the cloud. Sometimes you want to use them for multiple operations in a row. Like updating different sources and so on. In those cases you could call the respective ContentResolver methods multiple […]  Continue Reading  “Android: Better Performance with ContentProviderOperation”