Showing posts from June, 2017

Sketchware: How to create a digital clock?

It is very easy to include a real time digital clock in your Android App created with Sketchware.
Firstly, drag and drop a textview widget in a linear layout. Edit it's text size to 25 or more.
Now in the Logic of your app, add a Calendar component and a Timer component.

Then go to onCreate event and add a new block. I added a block named rep in my project.

After that define the new block function. Use TimerTask after ..1.. ms block and inside that use Calendar getNow block and textview setText block. Set text of textview to Calendar...Format.... block, and then repeat the block. The image below shows the blocks.

Lastly, in onCreate activity drag and drop the new block as shown below.
Now save and run your app. It will show current date and time updating every millisecond.
You can change the calendar Format to show the clock in your way. The format 'yyyy-MM-dd hh:mm:ss a' will show the time in AM/PM format.

Easiest way to create an App for your website

You can convert your website or mobile site into an app very easily. It doesn't need any programming language or any investment. The only thing you need is an Android mobile and Sketchware App.

Here is a video of how to create an App for your website in Sketchware.

Install Sketchware App in your mobile and start a new project. Write your app name and select an icon for your app.

Now in your project View area drag and drop Scroll(V) and inside that add webview widget. Set width of Scroll(V) to match parent and change padding to 0.

In Logic area of your project, in onCreate event add the WebView loadUrl block and write Url of your site in it.

Now add a new event, namely 'On back button press', in your app Logic area. On in On back button press, use if..else.. block. Add Webview goBack block as shown in image below. It should read, if WebView canGoBack then WebView goBack else Finish Activity.

Now save and Run the project. Your App is ready. You can get .apk file of your app…

How to set an object into pendulum motion in Sketchware?

How to create a pendulum in Sketchware?
Here is a video of how I created a pendulum in Sketchware:

Firstly​, in View field create a pendulum in a linear horizontal block, either using an imageview or textview. It should be such that the pendulum lies horizontally in right half of the linear horizontal block.

Next, create a new timer, and a new function.

Add a new variable t and set it's​ value to 0 in onCreate event. Also set rotation of textview to 90°.

Now define the new function in such a way that the linear horizontal rotates in pendulum motion repeatedly. Use the codes as shown in the image below.

And then save and run the project. It will show your image or text in pendulum motion.

Reset, move to previous webpage, and remove action bar in Sketchware

1. How to create a reset button in Sketchware?

If you have an app which takes written input and has one or more Edittext widgets being used, you can use a reset button in your app which clears all the inputs in Edittext view. The method is very simple. Simply insert a new button in your view field and name it as reset. Then in it's logic set all Edittext to blank. The picture​ below shows an example.
Now when you click the reset button, it will render all edittext fields blank.

2. How to enable going back or going to previous page in webview?

In webview if you have not used any code other than loadurl, the app exits on pressing back button on any webpage. To prevent that, in the logic of the app, use onBackPressed event and in that use following code:

if WebView ......... canGoBack then
      WebView.......... goBack
      Finish Activity

On using this code, if there is a webpage history, your app will lead you to a previous page of pressing back button on mobile, and in case of no…

How to create an animation in Sketchware?

Here I have used the example of battery charging images to show how we can create a simple animation in Sketchware.
Here is a video of the process:

Step 1.
Download Sketchware App.

Step 2.
Start a new project. Drag and drop a linear and an imageview block in the View area.

Step 3.
Use Image manager to add the images you want to use in animation. I have added seven different images of battery charging icon in this project.

Step 4.
Now in the Logic area add a new timercomponent. I have added a timer component named animate.

Step 5.
Now in the Logic area, click on onCreate event and add a new block. I have added a block named repeats.

Step 6.
In onCreate activity add:
TimerTask(animate)after 0 ms

Inside TimerTask add
repeats    (The new block you added)

Now select the imageview name and the first image you want to display.

Step 7.
Now define the new block you added. In my project it is repeats.
In the repeats defineFunction event use following blocks: