I need to get selected text from webview and constantly select text. I tried to select the text, and while I am trying to get the text using the clipboard, it shows me the null pointer exception in "clipboard.getText ()". I tried the code as
ClipboardManager mClipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0); shiftPressEvent.dispatch(webview); if(mClipboard!=null) { String text = mClipboard.getText().toString(); Toast.makeText(this, "select_text_now "+text, Toast.LENGTH_LONG).show(); }
I need to get selected text to highlight futher..please help me ..
deepa source share