In my app I want copy the selected data to the clipboard without using the contextual actionbar that comes after long press on text in the webview.
buttonPlay.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ClipboardManager mClipboard =
(ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN,
KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0);
shiftPressEvent.dispatch(webView1);
if(mClipboard!=null) {
text = mClipboard.getText().toString();
//Toast.makeText(MainActivity.this, "select_text_now "+text, LENGTH_LONG).show();
//***************############################################28112013
//online part added
MyTask myTask = new MyTask();
myTask.execute(text);
//#############################################################
return;
}
}
});
as you can see the text is fetched from the clipboard. I want to directly send the selected text to the clipboard on the press of this button. Please help, any suggestion is appreciated.