如何加载HTML文件存储的SD卡内的Web视图

如何加载HTML文件存储的SD卡内的Web视图

本文介绍了如何加载HTML文件存储的SD卡内的Web视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在/mnt/sdcard/packagename/files/something.html路径的HTML文件。现在我想将这个文件加载到web视图。

当我上网这一点,我听说过一些内容提供商,但仍然没有完全清除该怎么做。

任何答案?

由于提前,

Tejaswi Marakini


解决方案

 如果(!Environment.getExternalStorageState()。等于(Environment.MEDIA_MOUNTED)){
            Log.d(TAG,无SD卡);
}其他{
webComp.loadUrl(\"file://\"+Environment.getExternalStorageDirectory()+\"/packagename/files/something.html\");
}

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 about content provider, but still not cleared exactly how to do it.

Any answer?

Thanks in advance,

Tejaswi Marakini

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

这篇关于如何加载HTML文件存储的SD卡内的Web视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 14:43