개발도구/aOS - 안드로이드 개발
[안드로이드] WebView 로딩, 백, 앞
Hay's App
2011. 9. 20. 15:03
<ProgressBar android:id="@+android:id/progresssmall3"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center"
android:visibility="invisible"
/>
private ProgressBar pb3;
pb3 = (ProgressBar)findViewById(R.id.progresssmall3);
browser = (WebView) findViewById(R.id.webview);
browser.getSettings().setJavaScriptEnabled(true);
browser.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
Log.v("finish", "loading");
pb3.setVisibility(View.INVISIBLE);
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
super.onReceivedError(view, errorCode, description, failingUrl);
Toast.makeText(MenuMt.this, "로딩오류" + description, Toast.LENGTH_SHORT );
}
});