suomi35 suomi35 - 3 months ago 16
Android Question

How to add options to Android's native 'Edit text' context menu

Is it possible to add something to the list of items that shows up when a user long presses on any Edit Text? (Cut, copy paste, select text, select all, input method) I want to add another option to this menu, but cannot figure it out.

There is a duplicate of this question here, and the last comment for the first answer says it's 'possible, but not pretty'. Then the thread dies.

I'd really like to see any working example, dirty or not :)

Answer

Is it possible to add something to the list of items that shows up when a user long presses on any Edit Text?

If the EditText is in your activity, you can do that via onCreateContextMenu().

If the EditText is not in your activity, then no.

There is a duplicate of this question here, and the last comment for the first answer says it's 'possible, but not pretty'. Then the thread dies.

First, that post is two years old, which is nearly forever in Android years.

Second, I am fairly certain Mr. Haseman is incorrect in his assessment.