Issue
I am making an android app that uses a webview to visit a website. I am adding a feature, so that someone can press an option in the menu, and some text is added to the android clipboard.
Unfortunately, there would be no way to paste, as the dialog box on long click of a text entry box that usually appears isn't there by default.
How would I implement this? How would it be done?
Thank you for your time, Liamwli
Solution
If your paste textbox is an Android textbox, you can add a code like this;
textbox.setOnLongClickListener(new onLongClickListener(){
//do whatever you want like displaying popup or paste the wanted text
});
If not, you can't do that because you can't use Android function as you want, but HTML function.
I hope that i understood and responded your question.
EDIT: For webview, look around WebChromeClient. It enables to catch JS Alert. So, you'll be able to throw event in JS with a specific library, and then catch it with Android. With this function, onJsAlert(WebView view, String url, String message, JsResult result) throw an alert on touch then catch it in Android.
Answered By - Stephane
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.