마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

android] load html

0 추천

html 파일을 로드 할려고 합니다. 근데! 이 html파일은 제친구가 R에서 추출한 html 파일로서 지도 형식의 

html 파일입니다. Leaflet | © OpenStreetMap 맵으로서 마커가 하나찍혀있는 맵인데 안드로이드 상으로 불러올수 있는방법이 없을까요? 그냥 load.url 해봤는데 안되더라고요. html문서는 다음과 같습니다.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="data:application/x-javascript;base64, 복잡한 문자 </script>
<script src="data:application/x-javascript;base64, 복잡한 문자 </script>
이런식으로가다가 마지막에
</head>
<body style="background-color:white;">
<div id="htmlwidget_container">
  <div id="htmlwidget-adefce7f79a1ed29186f" style="width:100%;height:400px;" class="leaflet html-widget"></div>
</div>
<script type="application/json" data-for="htmlwidget-adefce7f79a1ed29186f">{"x":{"options":{"crs":{"crsClass":"L.CRS.EPSG3857","code":null,"proj4def":null,"projectedBounds":null,"options":{}}},"setView":[{"lat":37.566535,"lon":126.9779692},11,[]],"calls":[{"method":"addProviderTiles","args":["OpenStreetMap",null,null,{"errorTileUrl":"","noWrap":false,"zIndex":null,"unloadInvisibleTiles":null,"updateWhenIdle":null,"detectRetina":false,"reuseTiles":false}]},{"method":"addMarkers","args":[37.6085675032288,126.962499687546,null,null,null,{"clickable":true,"draggable":false,"keyboard":true,"title":"","alt":"","zIndexOffset":0,"opacity":1,"riseOnHover":false,"riseOffset":250},null,null,null,null,null,null,null]}],"limits":{"lat":[37.6085675032288,37.6085675032288],"lng":[126.962499687546,126.962499687546]}},"evals":[],"jsHooks":[]}</script>
<script type="application/htmlwidget-sizing" data-for="htmlwidget-adefce7f79a1ed29186f">{"viewer":{"width":"100%","height":400,"padding":0,"fill":true},"browser":{"width":"100%","height":400,"padding":0,"fill":true}}</script>
</body>
</html>
다음과 같이 나와있습니다.
익명사용자 님이 2017년 8월 22일 질문

1개의 답변

0 추천

 

webview.getSettings().setJavaScriptEnabled(true);

를 적용해도 안되시나요?

manifests파일에

<uses-permission android:name="android.permission.INTERNET"/>

도 적용되어있나요?

minor (13,710 포인트) 님이 2017년 8월 22일 답변
minor님이 2017년 8월 22일 수정
public class food1main extends AppCompatActivity {

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



        WebView wvExample = (WebView)findViewById(R.id.wvExample);
        wvExample.getSettings().setJavaScriptEnabled(true);
        wvExample.loadUrl("file:///android_assets/juo.html");
        wvExample.setWebViewClient(new WebViewClient());
    }
}
퍼미션도 허락했는데
웹페이지를 표시할수없습니다라고 뜹니다.

로켓은 다음과 같습니다.
08-22 16:14:44.701 7246-7481/com.example.kimg.foodtruck E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
08-22 16:14:44.741 7246-7246/com.example.kimg.foodtruck D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 48 - 0, 0) vi=Rect(0, 48 - 0, 0) or=1
08-22 16:14:44.751 7246-7481/com.example.kimg.foodtruck W/AudioCapabilities: Unsupported mime audio/mpeg-L1
08-22 16:14:44.761 7246-7481/com.example.kimg.foodtruck W/AudioCapabilities: Unsupported mime audio/mpeg-L2
08-22 16:14:44.761 7246-7481/com.example.kimg.foodtruck W/AudioCapabilities: Unsupported mime audio/x-ms-wma
08-22 16:14:44.771 7246-7481/com.example.kimg.foodtruck W/AudioCapabilities: Unsupported mime audio/x-ima
08-22 16:14:44.781 7246-7481/com.example.kimg.foodtruck W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
08-22 16:14:44.791 7246-7481/com.example.kimg.foodtruck W/AudioCapabilities: Unsupported mime audio/evrc
08-22 16:14:44.791 7246-7481/com.example.kimg.foodtruck W/AudioCapabilities: Unsupported mime audio/qcelp
08-22 16:14:44.791 7246-7481/com.example.kimg.foodtruck W/AudioCapabilities: Unsupported mime audio/qcelp
08-22 16:14:44.791 7246-7481/com.example.kimg.foodtruck W/AudioCapabilities: Unsupported mime audio/evrc
08-22 16:14:44.811 7246-7246/com.example.kimg.foodtruck I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@33c0c8b time:83475467
08-22 16:14:44.821 7246-7481/com.example.kimg.foodtruck W/VideoCapabilities: Unsupported mime video/wvc1
08-22 16:14:44.821 7246-7481/com.example.kimg.foodtruck W/VideoCapabilities: Unsupported mime video/x-ms-wmv
08-22 16:14:44.831 7246-7481/com.example.kimg.foodtruck W/VideoCapabilities: Unrecognized profile/level 32768/2 for video/mp4v-es
08-22 16:14:44.831 7246-7481/com.example.kimg.foodtruck W/VideoCapabilities: Unsupported mime video/wvc1
08-22 16:14:44.841 7246-7481/com.example.kimg.foodtruck W/VideoCapabilities: Unsupported mime video/x-ms-wmv
08-22 16:14:44.841 7246-7481/com.example.kimg.foodtruck W/VideoCapabilities: Unsupported mime video/x-ms-wmv7
08-22 16:14:44.841 7246-7481/com.example.kimg.foodtruck W/VideoCapabilities: Unsupported mime video/x-ms-wmv8
08-22 16:14:44.841 7246-7481/com.example.kimg.foodtruck W/VideoCapabilities: Unsupported mime video/mp43
08-22 16:14:44.881 7246-7481/com.example.kimg.foodtruck I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
08-22 16:14:44.981 7246-7246/com.example.kimg.foodtruck W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 7246
08-22 16:14:45.031 7246-7246/com.example.kimg.foodtruck V/ActivityThread: updateVisibility : ActivityRecord{2e17580 token=android.os.BinderProxy@91508c0 {com.example.kimg.foodtruck/com.example.kimg.foodtruck.MainActivity}} show : false
wvExample.getSettings().setDomStorageEnabled(true);
해주세요
감 사합    니다 해결됐습니다.
...