How to load html file stored inside SD card in the web view

前端 未结 3 1877
北荒
北荒 2020-12-19 17:03

I have an html file in /mnt/sdcard/packagename/files/something.html path. Now I want to load this file into the webview.

When I surfed for this, I heard something

3条回答
  •  -上瘾入骨i
    2020-12-19 17:30

    if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
                Log.d(TAG, "No SDCARD");
    } else {
    webComp.loadUrl("file://"+Environment.getExternalStorageDirectory()+"/packagename/files/something.html");
    }
    

提交回复
热议问题