Thursday, August 4, 2011

[android-developers] Re: Problem getting string from database

Some how I can't get that to work. I've made it work before exactly
like you mentioned with info.id but now it doesn't work.
This time I'm using a custom listview with checkboxes, could this have
anything to do with it?
I made a work around though, I added the _id when first filling the
list as a long for every post. So when I select an item and open the
context menu it takes the _id from the custom listview instead and
then it works.

Thanks for your suggetions!
André


On Aug 3, 4:58 pm, Kostya Vasilyev <kmans...@gmail.com> wrote:
> Hard to say what's going on in that code, but basically, you want to use
> the database _id value as much as possible (preferably, always), and not
> positions within the cursor's result set.
>
> Adapters have getItemId - make sure you return the value of your _id
> column, which is independent of the item's position within the list.
> This value will be carried into your onContextItemSelected as info.id.
>
> -- Kostya
>
> 03.08.2011 18:30, André пишет:
>
> > When I tried again on the second post instead I get row number 1. So
> > the first post is 0 and the second is 1. So when I read the second one
> > I get the info from the first post.
>
> --
> Kostya Vasilyev

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment