Estoy intentando implementar una función de copiar/pegar. ¿Cómo puedo obtener una selección de texto de un EditText?Android: obtenga la selección de texto de EditText
EditText et=(EditText)findViewById(R.id.title);
blabla OnClickListener en un botón:
int startSelection=et.getSelectionStart();
int endSelection=et.getSelectionEnd();
entonces estoy atascado. ¿Algunas ideas?
Una queja menor con el androide es que getSelectionStart() y getSelectionEnd() se refiere al orden en el que se seleccionó cosas, que doesn 't necesariamente conduce a Inicio
andy
Chicos, estoy haciendo su respuesta, pero mi método getselectionStart() y getSelectionEnd() están con problemas Ambos están devolviendo el mismo valor. – FpontoDesenv
et.getText() devuelve un editable. substring() nees a String. Necesita agregar toString(). Eso es - et.getText(). ToString(). Subserie (inicio, final) – earlcasper