How to show copy-paste options (context menu) for MultiAutoCompleteTextView when a button is clicked?

I am trying to show a context menu (copy-paste options) for a MultiAutoCompleteTextView when a button is clicked. Here is what I tried but didn't work.

mButton.setOnLongClickListener(new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            // the below line didn't work either.
            //mAutoCompleteTextView.showContextMenu();
            mAutoCompleteTextView.performLongClick();
            return true;
        }
    });

Is there a way to show the context menu? The menu is displayed when I click on the MultiAutoCompleteTextView for a long time, but I need to achieve the same functionality when you click on any other view of the action for a long time.

+1
source share

Source: https://habr.com/ru/post/1545456/


All Articles