[mono-android] ListView.SelectedItem not set ?
Tomasz Cielecki
tomasz at ostebaronen.dk
Thu Nov 3 09:44:46 EDT 2011
Just to show you a code sample:
__Snip how I create my ListView__
lv = FindViewById(Resource.Id.loggerListView) as ListView;
adapter = new LoggerAdapter(this, m_LogItems);
lv.Adapter = adapter;
lv.ItemClick += new EventHandler<ItemEventArgs>(lv_ItemClick);
__Snip my method to get the info I want__
void lv_ItemClick(object sender, ItemEventArgs e)
{
var send = sender as TextView;
if (send != null)
Toast.MakeText(this, send.Text, ToastLength.Short).Show();
}
On Thu, Nov 3, 2011 at 2:42 PM, Tomasz Cielecki <tomasz at ostebaronen.dk> wrote:
> In the item click event the sender is the view of the selected item.
> Wouldn't that be enough information for you?
>
> On Thu, Nov 3, 2011 at 1:20 PM, shebu <sylvain.hebuterne at gmail.com> wrote:
>> Hi,
>> I've tried to retrieve the selected item of a ListView in a "ItemClick"
>> event method with the ListView.SelectedItem property, but it seems to be
>> allways null : is it a bug or i'me wrong somewhere ?
>>
>> The underlying fact is that i don't want to use the classical
>> GetItemAtPosition(), for I find that it's not a good way to code it.
>>
>> thank's for answers...
>>
>> --
>> View this message in context: http://mono-for-android.1047100.n5.nabble.com/ListView-SelectedItem-not-set-tp4960909p4960909.html
>> Sent from the Mono for Android mailing list archive at Nabble.com.
>> _______________________________________________
>> Monodroid mailing list
>> Monodroid at lists.ximian.com
>>
>> UNSUBSCRIBE INFORMATION:
>> http://lists.ximian.com/mailman/listinfo/monodroid
>>
>
>
>
> --
> Med Venlig Hilsen / With Best Regards
> Tomasz Cielecki
> http://ostebaronen.dk
>
--
Med Venlig Hilsen / With Best Regards
Tomasz Cielecki
http://ostebaronen.dk
More information about the Monodroid
mailing list