How to insert a HTML file into a Sketchware app
How to insert a HTML file into your Sketchware app
Suppose you have created an HTML file and you want to create an Android app where you can view this html file. You can easily do this by following the steps given below.
1. Add a WebView webview1 in VIEW area of your android project in Sketchware.
2. Through sound manager add a sound file to your project (e.g.
file.mp3 ).
3. Save project and exit.
4. Go to file manager and copy your HTML file (myfile.html ).
5. In sdcard, navigate to .sketchware/resources/sounds/(your project no.)/ and paste the HTML file in the this folder.
6. Delete the sound file (file.mp3), and rename the html file (myfile.html )
to same as the sound file (file.mp3 ). Thus myfile.html is renamed file.mp3.
7. Open the project again in Sketchware, and in onCreate event, use the Block
WebView loadUrl........ ,
and put following path in it:
file:///android_res/raw/file.mp3
Or
file:///android_res/raw/file
Here file.mp3 is the name of the sound file which was replaced by HTML file. It has to be changed according to your file name.
8. Save and run the project. You will see your HTML file load in WebView. All the CSS and JavaScript used in the HTML file work too.
Post a Comment