9

I have a web page stored in my res/raw folder in android app. I want to access it and load it in the webview in my activity. Can anyone please tell me how am I supposed to do that. I have tried

webView.loadUrl(getResources().openRawResource(R.raw.myHtmlPage).toString());

but it dint work rather it gives a broken page.

kindly help me out.

regards FAS

Fahad
  • 93
  • 1
  • 3

1 Answers1

2

Do you mean you have the raw html as a string such as "<html>...</html>"?

If so then Webview.loadData() or Webview.loadDataWithBaseUrl() should work.

Squonk
  • 48,735
  • 19
  • 103
  • 135