How to insert a HTML file into a Sketchware app
How to insert HTML file in an app created in Sketchware?
Suppose you have created an HTML file using HTML, CSS and JavaScript, 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. button.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 (button.mp3), and rename the html file (myfile.html) to same as the sound file (button.mp3). Thus myfile.html is renamed button.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/button.mp3
Or
file:///android_res/raw/button
Here button.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.
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. button.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 (button.mp3), and rename the html file (myfile.html) to same as the sound file (button.mp3). Thus myfile.html is renamed button.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/button.mp3
Or
file:///android_res/raw/button
Here button.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.
Watch the video below to understand better:
The same method can also be used for inserting a gif image in Sketchware, for displaying in WebView.
sketchware does not pack asset folder apk yet... but it does pack several folders for graphics and sounds.... The one for sounds (raw) can be used to embed a full website and can easylly be called with loadurl... you do not need third part apk editor pro... see my html video player example (website and video are embed amd it works totally offline)
ReplyDeleteWhere I can watch the video , I also want to insert the html site into the application.Thanks
DeleteI saw your method. It is definitely better. Thanks.
ReplyDeleteNice ,.Thank you
ReplyDeleteWhere can we find Particular path of html file in android, because i'm getting Error File Not Found.
ReplyDeleteWatch the video. It works in new version of Sketchware.
ReplyDeleteI watched the video and try to do it. But i couldnt do. So please help me
Delete.sketchware->data->[foldername]->logic file is unreadable/encrypted on kew version. Please help.me
ReplyDeleteGo to .sketchware->resources ->sounds ->[foldername]->soundfile.mp3
DeleteReplace soundfile.mp3 with your html file. Rename your html file as soundfile.mp3.
Load it in webview.
I got folders with css and javascript along with my html file. I want to edit the logic file using droidedit to allow local files but the file seemed encrypted.
DeleteThank you so much sir but on click not working in XML can possible ?
ReplyDeleteNice Blog.....thanks for this.... Just visit App in Minute can create Application and website without burden. App In Minute has the affordable Pricing and Making Plan by App In Minute of Rs. 5 / Day (Rs.1825/ Year.) It can be develop your free android application , website product and service to the world. for more information about how to create an app
ReplyDeleteDimana sy bisa mendapatkan url tv livestreaming online yg outputnya menampilkan layar penuh?
ReplyDeleteBut why the external CSS and Image files does not work on the webview ?
ReplyDeleteHow do you add external files like images?
ReplyDeleteCan I preview, edit or insert excel sheets on sketchware?
ReplyDeleteCan I preview, edit or insert excel sheets on sketchware?
ReplyDeleteCan I preview, edit or insert excel sheets on sketchware?
ReplyDeleteSir I couldn't take my html file. Please help me to add my html file for skechware
ReplyDeleteDoes other files work too? Like opening a file inside the app.
ReplyDelete