Monthly Archives: November 2009

New Android app: ICSReader

After having ranted quite a bit about the lack of support for standards-based calendars and PIM in Android, I decided to implement something myself, to at least get it to a level where an Android phone would be of use to me. Since we have a functioning iCalendar export from our Oracle Collaboration Suite calendar at work, I decided to start out writing a parser for that. ICSReader is the result.

The software does a bit more than just read iCalendar files by now, and since it’s reached the critical junction where I want to expand the functionality significantly, the time has come where it gets its very first version number: 0.1

The very first version, 0.1, has the following features:

  • Imports an ICS file into a local database from an HTTP URL
  • Display of current events (ongoing, as well as -10/+30 minutes)
  • Display of the events of the next 48 hours
  • Display of events on a day by day basis
  • Detail display for each event

More importantly, it lacks the following features:

  • Support for multiple iCalendar sources
  • Support for individual ICS files, for instance from emails (via Intents)
  • A week view
  • A month view
  • Notifications, alarms, participants, GPS integration, peace on earth, end to world hunger, etc. etc.

The observant reader will have noticed that I have yet to provide a link to this software. Currently, it’s only been built for Android 2.0, and while it may serve a purpose for some people in need of an iCalendar reader, it is not yet sufficiently polished for me to feel comfortable in publishing it. If you happen to need it, post a comment, and I might well reconsider and post a usable build. Otherwise, I am going to work towards a new version with at the least support for multiple iCalendar sources before releasing it.

Got some new features you really want in an Android calendar application? Post a comment, and I’ll have a look. 🙂

Update: I released the app.

Creating a custom CursorAdapter for Android

I’ve been writing a bit more Android code, and came upon the need to write a custom CursorAdapter for a ListView, as the way I wanted to display data from a Cursor was dependent on relationships between different fields of the database.

Of the problems I encountered, the most obvious was when I tried to inflate views using View.inflate(), and found I would get the following error:

UnsupportedOperationException: addView(View, LayoutParams)
is not supported in AdapterView at android.widget.AdapterView

After a bit of rummaging around, I found that the following bit of code would work when attached to a ListView using setAdapter().

public class ExampleCursorAdapter extends CursorAdapter {
	public ExampleCursorAdapter(Context context, Cursor c) {
		super(context, c);
	public void bindView(View view, Context context, Cursor cursor) {
		TextView summary = (TextView)view.findViewById(;
	public View newView(Context context, Cursor cursor, ViewGroup parent) {
		LayoutInflater inflater = LayoutInflater.from(context);
		View v = inflater.inflate(R.layout.item, parent, false);
		bindView(v, context, cursor);
		return v;

The above example code doesn’t actually require a CursorAdapter, it would easily be implemented using a SimpleCursorAdapter, but it serves to show the idea. Basicly, get a LayoutInflater from the context, and use the version of inflate() that does not attach to the root view.