Android Question Edittext: remove the display of the "context menu"

Status
Not open for further replies.

mberthe

Member
Licensed User
Longtime User
I used the solution given by Erel:

B4X:
Sub ContextMenu_Create(AM As JavaObject, Fw As View)
    ActionMode=AM
    FocusedView=Fw
    Dim menu As JavaObject = ActionMode.RunMethod("getMenu", Null)
    menu.RunMethod("clear", Null)
End Sub

#if Java
 
 import android.view.*;
 import anywheresoftware.b4a.AbsObjectWrapper;
 import android.text.Selection;
 import android.widget.EditText;

    @Override
    public void onActionModeStarted(ActionMode mode) {
        processBA.raiseEvent(this, "contextmenu_create", AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), mode),
            AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.ConcreteViewWrapper(), getCurrentFocus()));
        super.onActionModeStarted(mode);
    }

    @Override
    public void onActionModeFinished(ActionMode mode) {
        super.onActionModeFinished(mode);
    }
    public static int getSelectionLength(EditText et) {
        return Selection.getSelectionEnd(et.getText()) - Selection.getSelectionStart(et.getText());
    }

#End If

For Android 4 devices the "context menu" is not changed but it doesn't matter.

For Android >= 5 it works except for the menu item "select all"
 

Jorge M A

Well-Known Member
Licensed User
Please, don't post duplicate threads.
 
Upvote 0
Status
Not open for further replies.
Top