我有一些文字被选择的EditText。我想从EditText上的点击按钮的选定文本。
请建议我使用的链接或样品code。
解决方案 的EditText等=(EditText上)findViewById(R.id.edit);
INT startSelection = et.getSelectionStart();
INT endSelection = et.getSelectionEnd();
字符串selectedText = et.getText()的toString()子(startSelection,endSelection)。
I have a edittext in which some text are selected . I want to get only selected text from edittext on click of button .
Please suggest me usable link or sample code.
解决方案EditText et=(EditText)findViewById(R.id.edit);
int startSelection=et.getSelectionStart();
int endSelection=et.getSelectionEnd();
String selectedText = et.getText().toString().substring(startSelection, endSelection);