That's the reason:
http://android-developers.blogspot.com/2008/12/touch-mode.html

And to get the selected item, use the following:

    @Override
    public boolean onContextItemSelected(MenuItem item) {
        final AdapterView.AdapterContextMenuInfo info =
(AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    }

The info object contains everything you need.

On Thu, Jan 22, 2009 at 8:26 PM, Anonymous Anonymous
<[email protected]> wrote:
> Hi All,
>
> Me too have the same problem,whenever i uses getSelectedItemId(), its
> returning some weired value,however getcount() and other things works fine.
>
> Thanks
> Steve
>
> On Fri, Jan 23, 2009 at 6:05 AM, polo777 <[email protected]> wrote:
>>
>> Hi everyone,
>>
>> I have a list using a customized BaseAdapter. When one element of the
>> list is hit during a long time, a contextual menu appears. I want to
>> use this one to delete or edit the selected item but I don't know how
>> to get id or anything else that could help me.
>>
>> I tried getListView.getSelectedItem() thinking that it will give me
>> the object returned by the method getItem(int position) inherited in
>> my customized BaseAdapter. I got null.
>> When I tried getSelectedItemId(), I got -1.
>>
>> Does someone have a solution?
>>
>> Thanks a lot,
>> Polo
>>
>>
>
>
> >
>



-- 
Romain Guy
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to