Thank you for that,  but how can I show that the item has been selected?

----- Original Message ----- From: "Mark Murphy" <mmur...@commonsware.com>
To: <android-developers@googlegroups.com>
Sent: Tuesday, January 26, 2010 11:54 PM
Subject: Re: [android-developers] How to select an item in a listview by code


Michael J McLean wrote:
I tried you suggestion but got an error message.

So I tried

myListView.setSelection(1);

  No error message but it doesn't work

Yes, it works.

When users use their touchscreens, there is no notion of "selection",
only item clicks. Hence, in touch mode, setSelection() will have no
visible impact.

Only if the user had been using the D-pad/trackball/whatever immediately
prior to setSelection() will the orange selection bar appear, because
then the user is not in touch mode, and the selection bar indicates
which row will be clicked if the user presses the center button on the
D-pad.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training in US: 22-26 February 2010: http://onlc.com

--
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


--------------------------------------------------------------------------------



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.730 / Virus Database: 271.1.1/2645 - Release Date: 01/26/10 05:36:00

--
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to