In android webview we can able to select the text in web pages. After selection finished , the toast will appear like "text copied to clipboard". Whether its possible to avoid that toast? Also i want to call a function after selecting text. how can i do this?
help me...
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == android.view.MotionEvent.ACTION_UP) {
// when user finished selection this loop will execute to get
// selected text in webview.
if(mark_text == true)
{
mark_text = false;
clipboardManager.setText("XXXXXX");
webView.postDelayed(onClipBoard, 1000);
}
}
}
private Runnable onClipBoard=new Runnable() {
public void run() {
// if selected text is copied in clipboard toast will show the
// correct text otherwise else part will execute
if (!clipboardManager.getText().toString().equalsIgnoreCase("XXXXXX")) {
Toast.makeText(getApplicationContext(),
"selected Text = " + clipboardManager.getText().toString(),
Toast.LENGTH_LONG).show();
clipboardManager.setText("XXXXXX");
} else {
webView.postDelayed(onClipBoard, 1000);
}
}
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With