Solution 1 :
try using –>
myWebView.findAllAsync(findBox.getText().toString());
Problem :
I have this part of code to search in a webview a word user types…
findBox = findViewById(R.id.findBox);
findBox.setSingleLine(true);
findBox.setOnKeyListener((v, keyCode, event) -> {
if ((event.getAction() == KeyEvent.ACTION_UP) || ((keyCode == KeyEvent.KEYCODE_ENTER)))
{
myWebView.findAll(findBox.getText().toString());
try
{
// Can't use getMethod() as it's a private method
for (Method m : MainActivity.class.getDeclaredMethods())
{
if (m.getName().equals("setFindIsUp"))
{
m.setAccessible(true);
m.invoke(myWebView, true);
break;
}
}
}
It is working but android studio show findAll is deprecated as of API 16. Any ideas how to solve?
Comments
Comment posted by Shahriyar Aghajani
use findAllAsync