Posts

Showing posts from May, 2017

How to use checkbox in Sketchware to select between two options?

Image
How to use checkbox in Sketchware to select between two options?
Here is a description of how checkbox can be used in Sketchware to select between male and female.
1. First, place two 'checkbox' widgets in your View field. Change their texts to 'Male' and 'Female'.
2. Complete building your View field.


3. In onCreate method set visible both checkbox1 and checkbox2.
4. On checkbox1 clicked setEnable checkbox2 false.

5. On checkbox2 clicked setEnable checkbox1 false.

6. On button click use if-else checkbox1/checkbox2 getchecked and write your desired logic.

How to enable download in webview in Sketchware apps?

Image
How to enable download in an app created with Sketchware?
Suppose you have created an app in Sketchware which uses webview to open a site. You can seamlessly explore the site in your app. But the download links in the webview field do not work.
But it is possible to make it work by exporting the source code. You can edit the code in either Android studio or Eclipse to add your desired features and then recompile it. I tried to do that but soon realized that setting up environment for development of Android app is not easy for a naive like me. But it can be done by code injection or by using another mobile app called Anacode.

Enabling download from webview in Sketchware using add source directly block.

1. In VIEW area of your app insert a WebView (webview1).

2. In LOGIC area, in onCreate event, add an add source directly block. In this block add the following code:
webview1.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent, String conten…

How to insert a HTML file into a Sketchware app

Image
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…

How to insert html code in Android app created with Sketchware

Image
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.
Step 2
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 fill this block as below:
WebViewwebview1loadUrldata:text/html, <html > <title> </title> <body> Write your HTML code here. </body> </html>
Step 4
Also add onBackPressed event and use following blocks:
Ifwebview1canGoBack
WebViewwebview1goBack
else
FinishActivity

Step 4
Save and Run your app. Your a…

Create a Sketchware app which links to a website and exits on its own

Image
How to create in Sketchware an app which links to a website on clicking it's icon but the App doesn't open itself.



1. Download Sketchware, Open Sketchware App, go to my projects and start a new project.
2. Fill the App settings: package name, project name, App name, version, app icon.
3. Leave View area (main.xml) empty.
4. Go to Logic. Add a new intent component and name it 'web' (or anything else you want).
5. Now click on onCreate event. On activity onCreate add:
Intent web setAction ACTION_VIEW
Intent web setDatahttp://yourweb.com (URL of website to be opened)
StartActivity web
Finish Activity 


6. Save and Run the App.
7. Your app will exit itself and open http://yourweb.com in default browser on your device.
8. End of tutorial.

In Sketchware: How to create a calculator for any simple formula?

Image
Create a simple formula calculator Android app in Sketchware
Here is a tutorial to calculate using any simple formula, for users of Sketchware Android app. I'll take the example of calculating volume of a cone.Formula is: Vcone = 1/3 × pi × r2 × h
Step 1 Download Sketchware

Step 2
Go to my projects and start a new project.
Fill details in Project Settings:-
Package name: com.cone
Project name: conevolume
App name: Cone Volume
App icon:
App version: 1.0

Step 3 Create View of your app. It is saved as main.xml. The process is simple. In the view field drag and drop 'linear', 'textview', 'button' and 'edittext' to places where you want them to appear.
In my project I have inserted 5 'linear', 4 'textview', 3 'edittext' and 2 'button'.

Edit the 'textview' fields to write details. Modify text of 'button' to write calculate, Reset, etc. Change background color of 'linear'. Modify Edittext to remove 'h…