I am new to android and i would like to know how to read selected word from a PDF file. My idea is that when i open a PDF book in android and highlight or select a word from the PDF, My app should be able to get the selected/highlighted word. I am planing to make Instant Dictionary App that can help anyone to improve their English by selecting any text from the PDF and translating it instantly. Could anyone please explain to me how to get the selected word/highlighted from PDF reader and what API i should use ? I have found some code for getting the selecting code from an Edit-Text:
EditText etx=(EditText)findViewById(R.id.editext);
int startSelection=etx.getSelectionStart();
int endSelection=etx.getSelectionEnd();
String selectedText = etx.getText().substring(startSelection, endSelection);