1

I need to add an OnLongClickListener to an EditText view.

I can get it to work alongside some default events, but I don't want the default events to trigger at all. As default behavior a dialog will appear to select Input Method.

I thought I had found a solution with setting the android:longClickable attribute in the view xml to false, but apparently that did nothing.

1 Answer 1

5

I'm not sure there's enough here for a proper answer, but here's a guess. If you return true, you've consumed the event and any further actions will not be taken. If you return false, you allow the OS to process the default LongClick action.

OnLongClickListener longClickListener = new OnLongClickListener() {
    @Override
    public boolean onLongClick(View v) {
        //doSomething();
        return true; //true = event consumed, false = event not consumed
    }
};

Not the answer you're looking for? Browse other questions tagged or ask your own question.