My application is displaying a list of items from my database, in
classic Android style, using a ListActivity and a SimpleCursorAdapter.
So far, so good.

However, when I select my item, move to another Activity, and then press
BACK and go back to my ListActivity, I find it's deselected its item and
scrolled all the way to the top. The ListActivity hasn't been stopped or
destroyed, merely frozen, so I'm surprised it's doing this.

Does anyone know why? And, more importantly, how can I stop it?

On a related note, with a ListActivity, is it my responsibility to save
the selected item in the icicle on freeze and restore it on thaw, or
will the ListActivity do it for me? If it is my job, does anyone know
how I can determine the selected item position given a cursor ID?
(ListActivity provides getSelectedItemId() which returns the id of the
currently selected item, but it *doesn't* provide a function to select
an item given the id --- instead it requires the list index.)

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "I have always wished for my computer to be as easy to use as my
│ telephone; my wish has come true because I can no longer figure out
│ how to use my telephone." --- Bjarne Stroustrup

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to