Grokking Android

Getting Down to the Nitty Gritty of Android Development

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”

How to Correctly Use SQL’s like in Android

By

Yesterday I stumbled about the correct usage of the LIKE-statement in conjunction with selectionArgs. My first attempt was to use it as this: Now this only led to this nice message in the log: Hm. Maybe I should just drop the dashs? But this also didn’t work. The exception though has changed: After searching around […]  Continue Reading  “How to Correctly Use SQL’s like in Android”

Using your Google Account in the Android Emulator

By

Whenever you need to access the People or Calendar app and want to add contacts or events you need an account. On the emulator though no account exists by default. So in this blog entry I am going to show you how to add your Google account to your emulator. Update: Google has dropped support […]  Continue Reading  “Using your Google Account in the Android Emulator”

Android Tutorial: Content Provider Basics

By

This is the first part of a three part tutorial covering Android’s content providers. Here I’m going to introduce content providers and to cover the basic concepts you need to make use of existing ones or to write content providers on your own. What are content providers? Content providers are Android’s central mechanism that enables […]  Continue Reading  “Android Tutorial: Content Provider Basics”

Android: Checking Connectivity

By

Whenever your app needs to access the internet, you should be sure that it can do so. To find more about the state of the connectivity, Android provides two classes that help you with this task: ConnectivityManager and NetworkInfo. As usual in Android you do not create the ConnectivityManager yourself, but ask the Context-object to […]  Continue Reading  “Android: Checking Connectivity”

A new blog

By

Hello, this is my new blog about Android development. Topics center around problems that I stumbled upon, solutions that I found helpful and the occasional rant about what annoys me. I also plan to keep an eye on usability concerns – though they are not the main topic here. Some things you can expect: A […]  Continue Reading  “A new blog”