list.getChildAt(0); which returned null
That will be true until the ListView starts getting rows from your Adapter.
list.getItemAtPosition(0) which returned
android.content.contentresolver$cursorwrapperin...@4375e088
That is a Cursor pointing at the 0th item in the Adapter's data.
Put the data whether a checkbox of a list-item is selected inside the
*adapter's* data, like my example i gave you in an earlier post
(selectableString.isSelected).
If you want to pre-select a check-box of a list-item, set its
corresponding element in the adapter (SelectableString) as selected
Thanks brothers --
I like the idea of the selected state of the data being in the
adapter, however, I'm not too excited about all the custom code for
such an obvious requirement! I am using a ListActivity subclass
configured as follows:
setListAdapter(buildNameAdapter());
Thanks brothers --
I like the idea of the selected state of the data being in the
adapter, however, I'm not too excited about all the custom code for
such an obvious requirement! I am using a ListActivity subclass
configured as follows:
setListAdapter(buildNameAdapter());
Here is what I ended up with. Do you guys care to grade this on an A
to F scale. I'm all of a sudden wondering when the startManagingCursor
(c); is going to slam my cursor shut, rendering this code broken. I
guess I could always read the Cursor into an Array and use that for my
adapter. When
Thanks Mark --
Doesn't this sort of violate the MVC pattern? Moreover, does it seem
odd to you that both the adapter and ListView have methods to cough up
a view? Pre-selecting check boxes is sure becoming a difficult-to-do
process!
I am in the debugger and experimenting with how I might get
I am using a SimpleCursorAdapter and having a similar problem with pre-
checking certain entries. This is my experimental code that I am
trying immediately following the instantiation of the adapter:
adapter = new SimpleCursorAdapter(this,
I am using a SimpleCursorAdapter and having a similar problem with pre-
checking certain entries. This is my experimental code that I am
trying immediately following the instantiation of the adapter:
adapter = new SimpleCursorAdapter(this,
Your ListView is only for display.
Your ListAdapter (in your case ArrayAdapter) is for getting and
manipulating the actual data. Only it's 'getView' method provides a
bridge between the data and the display-view...
Iterate over the elements in your ArrayAdapter to determine if one
item is
Your activity (and your list-view) is not yet visible in the onStart.
Don't use 'getChildCount' and 'getChildAt' method to check your
preference-settings.
BTW: If your activity is not yet visible, how can a user make a
selection?
Shouldn't you query in the onPause, for example.
And also, the
Thank you for your response, and I can understand your confusion.
Yes, when I run this activity, my screen displays the title text, two
items in my ListView (0 = Big Sound, 1 = Little Sound), and the
footer text. I can select either or both items, and when I press
Back, I can step through my
11 matches
Mail list logo