Faber Fedor wrote: > On Fri, Jan 9, 2009 at 8:15 PM, Mark Murphy <[email protected] > <mailto:[email protected]>> wrote: > Faber Fedor wrote: > > How do I get rid of either passing the _id around or not > displaying it? > > To not display it, don't put it in the list in the first place. > > Well, if you're going to be unreasonable about it! :-)
Yeah, well, I figured I'd cover all the bases... Besides, I was guessing that the only reason you put it in the list in the first place was to have it available to you in the callbacks. > I'm not quite sure how you're handling a double-click (double-clicks > aren't that common in Androidland, AFAIK), > > I'm not handling it; I just double-click in the emulator and it Just > Works. Maybe the second click is ignored? I'll test it tomorrow. If you're overriding onListItemClick() or something like that, a single click is all you need. > but most of the click-related > callbacks have a "long id" parameter that should be the _id of the > clicked-upon row from your Cursor. > > Now *that's* magical! How does the callback know I have a long id and > that it's the _id on the SQLite table? Because if you *don't* have _id in the Cursor you feed to the SimpleCursorAdapter, the adapter gets cranky and raises errors. > If I change my > SimpleCursorAdapter to, oh, I don't know, an ArrayAdapter, do I have to > change the parameters in my OnClickItemList? I'm not sure what the callbacks get for "long id" from ArrayAdapter. What has also worked for me is to simply re-point the Cursor (using movetoPosition()) to the row indicated by the position parameter. Then, you can grab whatever data you need. I don't know if this works by design or if future editions of Android will assume the Cursor is untouched and my changing the position will screw things up. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

