[android-developers] Re: Long click on list activity item

2012-05-21 Thread Kaptkaos
Ah, this was exactly what I needed. Thanks for the tip!

-- 
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

[android-developers] Re: Long click on list activity item

2009-03-31 Thread matthias

Hi,

On Feb 22, 9:53 pm, an...@akapost.com wrote:
 ...
 The standard onListItemClick() will still fire as well; my best guess
 there is to keep a suppression boolean around, which isn't pretty.
 Any other thoughts on this?

just return true from onItemLongClick(); this means you have consumed
the event, so it won't propagate up to the normal click handler.

Cheers,
Matthias
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Long click on list activity item

2009-02-22 Thread anon8

Try looking at:

AdapterView.onItemLongClick()

ListView implements AdapterView, so you'll have access to that juicy
method, which will pass the id of the item clicked as well as the
item's view the same as with onListItemClick().

{begin code}

// ListActivity has a ListView, which you can get with:
ListView lv = getListView();

// Then you can create a listener like so:
lv.setOnItemLongClickListener( new AdapterView.OnItemLongClickListener
(){
@Override
public boolean onItemLongClick(AdapterView? av, View v, int
pos, long id) {
onLongListItemClick(v,pos,id);
return false;
}
});

// You then create your handler method:
protected void onLongListItemClick(v,pos,id) {
  Log.i( TAG, onLongListItemClick id= + id );
}

{end code}

The standard onListItemClick() will still fire as well; my best guess
there is to keep a suppression boolean around, which isn't pretty.
Any other thoughts on this?

Phrases I searched for before finally stumbling across the proper
docs:
listactivity hold
listactivity longclick
android list long click
listactivity long click
listactivity long touch
android listview onLongClickListener



On Jan 2, 4:04 am, tranbinh.b...@gmail.com tranbinh.b...@gmail.com
wrote:
 Hi,

 Maybe this can help:

     @Override
     public void onCreateContextMenu(ContextMenu menu, View view,
 ContextMenuInfo menuInfo) {
         AdapterView.AdapterContextMenuInfo info;
         try {
              info = (AdapterView.AdapterContextMenuInfo) menuInfo;
         } catch (ClassCastException e) {
             Log.e(TAG, bad menuInfo, e);
             return;
         }

         long l = getListAdapter().getItemId(info.position);
     }

 On Dec 1 2008, 7:12 pm, Thao thao.uye...@gmail.com wrote:

  Hi all,

  I have an Activity that implements a ListActivty. In there, I have a
  list of item that is wrapped by a custom adapter.

  I would like to enable long click on each item in my list, but I can't
  figure out how to do this...Could someone give an example please ?

  Thank.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Long click on list activity item

2009-01-03 Thread tranbinh.b...@gmail.com

Hi,

Maybe this can help:

@Override
public void onCreateContextMenu(ContextMenu menu, View view,
ContextMenuInfo menuInfo) {
AdapterView.AdapterContextMenuInfo info;
try {
 info = (AdapterView.AdapterContextMenuInfo) menuInfo;
} catch (ClassCastException e) {
Log.e(TAG, bad menuInfo, e);
return;
}

long l = getListAdapter().getItemId(info.position);
}



On Dec 1 2008, 7:12 pm, Thao thao.uye...@gmail.com wrote:
 Hi all,

 I have an Activity that implements a ListActivty. In there, I have a
 list of item that is wrapped by a custom adapter.

 I would like to enable long click on each item in my list, but I can't
 figure out how to do this...Could someone give an example please ?

 Thank.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---