开发者

How to display intent chooser when long click listview item?

开发者 https://www.devze.com 2023-04-10 03:55 出处:网络
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 u

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;
        }
    });
0

精彩评论

暂无评论...
验证码 换一张
取 消