티스토리 뷰
webView.setWebChromeClient(new webViewChromeClient());
/** * WebChromeClient 상속 * */ private class webViewChromeClient extends WebChromeClient { @Override public boolean onCreateWindow(WebView view, boolean dialog, boolean userGesture, Message resultMsg) { // TODO Auto-generated method stub return super.onCreateWindow(view, dialog, userGesture, resultMsg); } @TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public boolean onJsAlert(WebView view, String url, String message, final JsResult result) { // TODO Auto-generated method stub // return super.onJsAlert(view, url, message, result); new AlertDialog.Builder(view.getContext(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT) .setTitle("알림") .setMessage(message) .setPositiveButton(android.R.string.ok, new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { result.confirm(); } }).setCancelable(false).create().show(); return true; } @TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public boolean onJsConfirm(WebView view, String url, String message, final JsResult result) { // TODO Auto-generated method stub // return super.onJsConfirm(view, url, message, result); new AlertDialog.Builder(view.getContext(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT) .setTitle("알림") .setMessage(message) .setPositiveButton("예", new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { result.confirm(); } }) .setNegativeButton("아니오", new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { result.cancel(); } }).setCancelable(false).create().show(); return true; } }
'개발 > 개발 자료' 카테고리의 다른 글
알아두면 좋은 시스템변수 (0) | 2014.10.30 |
---|---|
(Android) 로딩화면 몇초 후에 넘어가게 하기 (0) | 2014.10.19 |
Intent Video 실행시키기 (0) | 2014.10.11 |
(Android) overridePendingTransition( int enterAnim, int exitAnim ) (0) | 2014.08.13 |
(JSP) Mysql, Oracle 등 DB데이터를 엑셀로 다운받는방법 (0) | 2014.08.03 |
댓글