Widget - Webview Find

edittext1.setSingleLine(true);

edittext1.setOnKeyListener(new OnKeyListener() {

public boolean onKey(View v, int keyCode, KeyEvent event) {
if ((event.getAction() == KeyEvent.ACTION_DOWN) && ((keyCode == KeyEvent.KEYCODE_ENTER))) {

webview1.findAll(edittext1.getText().toString());
try {
for (java.lang.reflect.Method m : WebView.class.getDeclaredMethods()) {
if (m.getName().equals("setFindIsUp")) {
m.setAccessible(true);
m.invoke(webview1, true);
break;
}
}
} catch (Exception ignored) {
} finally {
android.view.inputmethod.InputMethodManager inputManager = (android.view.inputmethod.InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
View vv = getCurrentFocus();
if (vv != null) {
inputManager.hideSoftInputFromWindow(v.getWindowToken(), android.view.inputmethod.InputMethodManager.HIDE_NOT_ALWAYS);
}
}
}
return false;
}
});

//Add Button For Next Add this on button Listener
webview1.findNext(true);

//Add Button Close Search add this again
webview1.clearMatches();

Komentar

Cara pembuatan Apps paling Populer

Create Stopwatch App in Android using Sketchware

How to enable download in webview in Sketchware apps?

TextInputLayout in Sketchware

Create Stopwatch App in Android using Sketchware

A Flash Light App in Sketchware

How to integrate Admob Ads in Sketchware project using AIDE?

How to find and​ highlight a word in a text field in Sketchware?

Firebase Login/Register with email verification

Codes for modifying Action Bar in Sketchware

Code for implementing Notifications in Sketchware