WEBVIEW
#AndroidManifast.xml
permission 지정
#java
WebSettings webSettings = mWebView.getSettings();
// 자바 스크립트 허용
webSettings.setJavaScriptEnabled(true);
//webSettings.setAllowContentAccess(true);
//webSettings.setAppCacheEnabled(true);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
mWebView.setWebContentsDebuggingEnabled(true);
}
mWebView.loadUrl(baseUrl + getResources().getResourceEntryName(R.raw.appointment));
그러나! alert는 뜨지 않는다.
#경로
InputStream remoteUrl = getResources().openRawResource(R.raw.appointment);
// String htmlStr = readHtml(remoteUrl);
// mWebView.loadData(html, "text/html", "utf-8");
// String mimeType = "text/html";
// String encoding = "UTF-8";
String baseUrl = "file:///android_res/raw/";
WebSettings webSettings = mWebView.getSettings();
#debug
chrome remote debug
#url
chrome://inspect/#devices
- device : usb debug check
- 해당 페이지로 들어가면 연결된 디바이스 목록이 뜬다.
- 디버깅 명령 후 웹뷰로 들어가면 해당 페이지 목록이 뜬다.
- 'inspect' 클릭하면 크롬 개발자 도구 처럼 창이 뜬다.
- 디버깅 가능.
#source
- 해당 소스 추가
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
mWebView.setWebContentsDebuggingEnabled(true);
}
#webview 작성시 꼭 볼것
https://developer.android.com/reference/android/webkit/WebView.html
#library마다 디자인 차이 조금 있음..
http://stackoverflow.com/questions/38053779/android-webview-how-to-change-javascript-alert-title-text-in-android-webview