Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load html files from raw folder in web view [duplicate]

How to load html files in WebView from raw folder. I don't know how to add the path of these html files in WebView.loadData() function. I know how to load file from asset folder in WebView but here getting problem with raw folder.

Thanks in advance

like image 472
unflagged.destination Avatar asked Jan 05 '13 11:01

unflagged.destination


1 Answers

Use this code for Load html files from raw folder in web view:

For more information see the javadoc for WebView:

     public class ViewWeb extends Activity {               @Override               public void onCreate(Bundle savedInstanceState) {                   super.onCreate(savedInstanceState);                 setContentView(R.layout.webview);                    WebView lWebView = (WebView)findViewById(R.id.webView);                 lWebView.loadUrl("file:///android_res/raw/your_file_name.html");             }           } 
like image 167
Dixit Patel Avatar answered Oct 06 '22 13:10

Dixit Patel