Archive for May, 2012

Displaying Error Hints in Forms on Android

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 […]

Android Tutorial: Using Content Providers

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 […]

Finding all View-IDs of an Android UI

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 […]

Android: Better Performance with ContentProviderOperation

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 […]

How to Correctly Use SQL’s like in Android

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 […]

Android Tutorial: Content Provider Basics

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 […]

Android: Checking Connectivity

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 […]

A new blog

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 […]

Subscribe to RSS Feed My G+-Profile Follow me on Twitter!