How to insert html code in Android app created with Sketchware
How to insert HTML code to Android app created with Sketchware?
If you are not using Sketchware, you need to know that it is an Android app which can be used to develop real android apps using block language, directly on your Android device. Download Sketchware
Here is a step by step guide to inserting HTML code into your app in Sketchware.
Step 1
Start new project and fill details in project settings.
Start new project and fill details in project settings.
Step 2
In your app View in Main.xml or any other page where you want to insert HTML code, insert webview widget.
In your app View in Main.xml or any other page where you want to insert HTML code, insert webview widget.
Step 3
Now go to Logic of your page (MainActivity.java for Main.xml) and in onCreate event use following block:
WebView ......... loadUrl .............
Now go to Logic of your page (MainActivity.java for Main.xml) and in onCreate event use following block:
WebView ......... loadUrl .............
Now fill this block as below:
WebView webview1 loadUrl data:text/html, <html > <title> </title> <body> Write your HTML code here. </body> </html>
WebView webview1 loadUrl data:text/html, <html > <title> </title> <body> Write your HTML code here. </body> </html>
Step 4
Also add onBackPressed event and use following blocks:
If webview1 canGoBack
WebView webview1 goBack
else
FinishActivity
Step 4
Save and Run your app. Your app will show contents of your HTML code at the place where webview is located.
Also add onBackPressed event and use following blocks:
If webview1 canGoBack
WebView webview1 goBack
else
FinishActivity
Step 4
Save and Run your app. Your app will show contents of your HTML code at the place where webview is located.
You can use CSS and JavaScript in your code. You can insert links to gif and images.
To enable the links in the HTML code, and to enable JavaScript in the HTML code, insert the following code using 'add source directly' block in onCreate.
To enable the links in the HTML code, and to enable JavaScript in the HTML code, insert the following code using 'add source directly' block in onCreate.
WebSettings webSettings=webview1.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setJavaScriptCanOpenWindowsAutomatically(true); if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { webSettings.setAllowFileAccessFromFileURLs(true); webSettings.setAllowUniversalAccessFromFileURLs(true); }
please provide video also
ReplyDeleteSir submit botan in profile page help me
DeleteProvide tutorial for grid view
ReplyDeleteIf you are editing the code then see this tutorial: https://developer.android.com/guide/topics/ui/layout/gridview.html
DeleteElse to create gridview like view in Sketchware watch this https://youtu.be/6HIDwm0HXXo
Thank you
DeleteThank you
Deletehello friend, where will the accompanied image files go.
ReplyDeleteYou can either write the web url of image in html, or you have to create assets folder, add image and link to it using apk editor pro.
Deleteyou can embed the image as base64 if you use this technique (url containing html code)
DeleteThanks Patrick, I will try
DeleteThanks, I will try Genius.
ReplyDeleteBest time to shop marijuana
Deletehttps://buymarijuana.olistshops.com/
Best time to shop marijuana
Deletehttps://buymarijuana.olistshops.com/
Dear SANJEEV, I have tried using apk editor pro, assets folder...but how to give the link?
ReplyDeleteI have the same doubt, please answer me Sanjeev Sir.
DeleteThis comment has been removed by the author.
ReplyDeleteIt works well with local html file and jpeg files in assets folder but not with insert code method
DeleteYes links do not work when you insert a html file in assets folder. Also JavaScript do not work, because they are not enabled.
DeleteYou can inject codes to make them work, but I am not aware of the codes.
DeleteI have updated the code to be inserted by code injection to enable external links and to enable JavaScript.
DeleteThanks Friend
ReplyDeleteI also liked your video on youtube very much.. I also liked your quiz program
ReplyDeleteThanks again.. Keep up the good work
Plz clear views step4
ReplyDeleteI have added an Image in step 4 to make it clear.
DeleteApakah ini bisa bekerja untuk facebook..?
ReplyDeleteyour forth step's pic give me new idea thanks
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeletehow can i import PDF files in sketchware?
ReplyDeletethanks in advance
Pleassssse i dont't want make gif
ReplyDeleteiwant to import gif from my device but it dosent support
What can i do please??
The app doesn't work the JavaScript what should I do.
ReplyDeleteWhat should be path to image file?
ReplyDelete<img src="file:///storage/emulated/0/pic.jpg"?
I want to know in appsgeyser
ReplyDeletephp ko run karsakte hai kia
ReplyDeletecan i run php file
Maybe it's not
DeleteNice of top 10 article.
ReplyDelete