I want to load a picture called map.png set in my drawable resource in the WebView.
I found in another answer this suggestion webview.loadUrl("file://...") but I don't understand how to set it properly. I always get error that the requested file was not found. This is what I wrote
`public class Map extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
WebView mWebView =(WebView)findViewById(R.id.webMap);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("file://res/drawable/map");`
This is the XML
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webMap"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
</WebView>
setContentView(R.layout.map);
WebView mWebView =(WebView)findViewById(R.id.webMap);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("file:///android_assets/map)");
This is a complete screen shot
This is the new code but I get an error
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
WebView myWebView = (WebView) findViewById(R.id.webMap);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.getSettings().setBuiltInZoomControls(true);
myWebView.setWebViewClient(new MyWebViewClient());
myWebView.loadUrl("file://mnt/sdcard/map.png");