I have a list view that contains some data, I want to share it by through intent chooser.
I found long click on a listview item will trigger context menu event, and the 开发者_开发百科common way to use a context menu is the build a menu in onCreateContextMenu() and then get line index from menuInfo in onContextItemSelected(). But in my case I want to display intent chooser directly when when I long click the list view item.
Do I make myself understood? How can I archieve this?
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
return true;
}
});
精彩评论