Sunday, October 25, 2009

Google Android ArrayAdapter vs SimpleCursorAdapter

I've been trying to create a "mover" interface in Android. I use the term "mover" to describe a interface displaying two lists where you can move items from one list to the other. This can be done with arrow buttons if you have enough screen real estate, but I don't think that will work on the small screen of a cell phone.

In any case, my first attempt contained two ListViews, one with an ArrayAdapter of Strings, the other with a SimpleCursorAdapter. For reasons which I haven't yet figured out, the items in one list were a different font size than in the other list. The SimpleCursorAdapter font size was smaller than the ArrayAdapter. I tried a number of changes in the layout file (e.g., changing weights and such), but none of them worked.

I ended up reworking my data storage so that I could use SimpleCursorAdapters for both ListViews, and the font sizes matched. I'm guessing that the Adapters (which I consider the "Controller" in the model-view-controller paradigm) are making some decisions "behind the scenes".

Onward to the next Android mystery...

No comments: