I'm just starting out in programming and I've run into an issue with my webview code. In my implementation, I have a onPageFinished method with JavaScript logic inside to extract plain text from the webview. However, the onPageFinished method always completes after the main thread, preventing me from executing anything else afterward.
Is there a way for me to check if onPageFinished has finished or delay the main thread so it doesn't end before onPageFinished? I'm really in need of a solution.
Below is the code snippet:
WebViewActivity
class
public class WebViewActivity extends Activity{
String[] paraText;
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@SuppressLint("JavascriptInterface")
@Override
public void onCreate(Bundle savedInstanceState) {
// Rest of your code here...
}
// Additional methods within the class...
}