Android click on the text in EditText, how to get the specific location of the current text in the input text?

Android click on the text in EditText, how to get the specific location of the current text in the input text?

Apr.16,2021

use editText.setSelection (Edittext.length ())

)

Example

EditText editText = findViewById(R.id.editText);
editText.setSelection(editText.getText().length());

use this method to disable popping up of the system keyboard, call the custom keyboard, and return false, in the setOnTouchListener event of editext otherwise the cursor cannot be moved to the position where the finger is clicked.
private void showEditText (EditText edit) {

    if (android.os.Build.VERSION.SDK_INT <= 10) {//4.0
        edit.setInputType(InputType.TYPE_NULL);
    } else {
        this.act.getWindow().setSoftInputMode(
                WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
        try {
            Class<EditText> cls = EditText.class;
            Method setShowSoftInputOnFocus;
            setShowSoftInputOnFocus = cls.getMethod("setShowSoftInputOnFocus",
                    boolean.class);
            setShowSoftInputOnFocus.setAccessible(true);
            setShowSoftInputOnFocus.invoke(edit, false);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d391-2c36a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d391-2c36a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?