2
, 특히이 방법은안드로이드 웹보기
private void setupWebView(){
String MAP_URL = "http://gmaps-samples.googlecode.com/svn/trunk/articles-android-webmap/simple-android-map.html";
String centerURL = "javascript:centerAt(" + mostRecentLocation.getLatitude() + ","+ mostRecentLocation.getLongitude()+ ")";
webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
//Wait for the page to load then send the location information
webView.setWebViewClient(new WebViewClient(){
@Override
public void onPageFinished(WebView view, String url){
webView.loadUrl(centerURL);
}
});
webView.loadUrl(MAP_URL);
}
내가 발견 한 것을 나는 배치하면이
private void setupWebView(){
String MAP_URL = "http://gmaps-samples.googlecode.com/svn/trunk/articles-android-webmap/simple-android-map.html";
String centerURL = "javascript:centerAt(" + mostRecentLocation.getLatitude() + "," + mostRecentLocation.getLongitude()+ ")";
webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
//Wait for the page to load then send the location information
webView.setWebViewClient(new WebViewClient(){
@Override
public void onPageFinished(WebView view, String url){
//DO NOTHING
}
});
webView.loadUrl(MAP_URL);
webView.loadUrl(centerURL);
}
그것은 더 이상 작품처럼 webView.loadUrl(centerURL);
직접 후 webView.loadUrl(MAP_URL);
. 따라서 centreAt(..)
자바 스크립트 메소드는 MAP_URL
에 포함되어 있습니다.
URL이 실제로로드되기 전에 webView.loadUrl(..)
메서드가 반환되는지 궁금합니다. 최상위 메서드가 자바 스크립트를 실행하기 전에 완전히로드되기를 기다리는 방식이므로 모양이 바뀝니다.
신음 .... 난 그냥 하루 종일 낭비는 것을 발견 :
는 웹보기 페이지 로딩 사용WebViewClient.onPageFinished(..)
을 모니터링 할 수 있습니다. 오 잘. 피터 확인을위한 환호. – Tim