this is my sample code
@Override
public boolean onContextItemSelected(MenuItem item)
{
final AdapterView.AdapterContextMenuInfo acmi =
(AdapterView.AdapterContextMenuInfo)
item.getMenuInfo();
long clickedId = (long) acmi.id;
switch (item.getItemId()) {
case INSERT_ID:
Toast.makeText(this, "'"+clickedId+"'", Toast.LENGTH_SHORT).show
();
return true;
no matter what list item i select it always shows 6
On Nov 28, 6:54 pm, Protocol-X <[EMAIL PROTECTED]> wrote:
> Thanks for the reply. I tried your method but now instead of 0 every
> time i get 6
>
> On Nov 26, 1:58 pm, G <[EMAIL PROTECTED]> wrote:
>
> > @Override
> > public boolean onContextItemSelected(MenuItem item) {
> > // TODO Auto-generated method stub
> > AdapterContextMenuInfo acmi = (AdapterContextMenuInfo)
> > item.getMenuInfo();
> > long clickedId = acmi.id;
>
> > }
>
> > In the above case, clickedId is the id of the row that was long-
> > pressed to bring up the context menu. You can also get a specific view
> > in the row that was long pressed...
> > TextView tv = (TextView)acmi.targetView.findViewById
> > (R.id.some_view_inside_your_row_view)
>
> > Take a look at the docs for AdapterContextMenuInfo for more info.
>
> > On Nov 25, 1:15 pm, Protocol-X <[EMAIL PROTECTED]> wrote:
>
> > > How do u the row id or position of a listactiviy when using a context
> > > menu. It always seems to always select 0 for the row id.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---