jeudi 17 avril 2014

onPageFinished of webViewClient class does not work


Vote count:

-1




I was reading a tutorial about webViewClient() and as I was bringing what I am learning into practice, I encountered the public void onPageFinished(WebView view, String url) Although I followed the tutorial accurately my application output is not the same as the tutorial's. Simply, my app did not show any difference than if I have not used public void onPageFinished(WebView view, String url) as if it has no functionality. Your comments will help me to better understand this topic.


JavaCode:



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_page00);

webView00 = (WebView) findViewById(R.id.webView00);
tvPageTitle = (TextView) findViewById(R.id.tvPageTitle);

webView00.getSettings().setJavaScriptEnabled(true);
webView00.setWebViewClient(new myWebViewClient());


/*The call to the setInitialScale() method scales the view to 30 percent of
the original size.*/
webView00.setInitialScale(20);
webView00.loadUrl("http://google.com");

}

public class myWebViewClient extends WebViewClient {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
String title = webView00.getTitle();
tvPageTitle.setText(title);
}
};


asked 2 mins ago






Aucun commentaire:

Enregistrer un commentaire