Showing posts from December, 2018

Age Calculator App in Sketchware

To create an Age Calculator App using DatePickerDialog in Sketchware follow the steps given below.

1. In VIEW area of your sketchware android project, insert a LinearH and inside it insert an EditText edittext1 for displaying Date of Birth, and an ImageView imageview1, for displaying calendar symbol.
Insert another LinearH and inside it insert an EditText edittext2, for displaying the age.

2. Create a more block extra.

3. In the more block extra use add source directly block and put following code.

// Define showDatePickerDialog(View).
public void showDatePickerDialog(View v) {
// Create and show a new DatePickerFragment.
DialogFragment newFragment = new DatePickerFragment();, "datePicker");

// Define a DialogFragment class DatePickerFragment.
public static class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener {
// Define a new Calendar for present date
Calendar now = Calendar.getInstance();

TimePickerDialog in Sketchware

To create a TimePickerDialog in Sketchware android project follow the steps given below.

1. In VIEW area of your sketchware android project, insert a LinearH and inside it insert a TextView textview1, and a Button button1.
For textview1 write text as '00:00'.

2. Create a more block extra.

3. In the more block extra use add source directly block and put following code.

public static class TimePickerFragment extends DialogFragment implements TimePickerDialog.OnTimeSetListener {
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
return new TimePickerDialog(getActivity(), this, hour, minute, android.text.format.DateFormat.is24HourFormat(getActivity()));

public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
TextView textview101 = getActivity().findViewById(;
textview101.setText(hourOfDay + ":" + minute);

* This cod…

Automatic text switching using ViewFlipper in Sketchware

In Sketchware, to display a list of sentences one by one by automatically switching to next sentence every few seconds, follow the steps given below.

1. In Sketchware project, in main.xml add a LinearLayout linear1, with width and height as MATCH_PARENT. Set a beautiful image as background of linear1.

2. Add a CustomView customview.xml. In this add a TextView textview1, with text size 40, width and height MATCH_PARENT, and gravity center_horizontal, center_vertical.

3. Add a String List string_list.

4. In onCreate, one by one add sentences to this list.

5. After adding items to string_list, use add source directly block and put following code in it.
ViewFlipper viewFlipper = new ViewFlipper(this);

LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(20, 20, 20, 20);
layoutParams.gravity = Gravity.CENTER;


Download a file from a web link in Sketchware

To download a file from any web url, we have to do following:
Define an AsyncTask which can do the download in background, i.e. in a thread different from the main UI thread. We need this because downloading large files on main thread may consume more memory and may lead the app to crash.Use HttpURLConnection to openConnection() for the url and create an InputStream for downloading the url.Create an OutputStream and write data from InputStream to File path in sdcard.Show download progress using onProgressUpdate method of AsyncTask.In onPreExecute() method of AsyncTask make ProgressBar VISIBLE.In onPostExecute method of AsyncTask, make ProgressBar GONE. To create such an app in Sketchware which can download file from link provided, follow the steps given below.
1. Create a new project in Sketchware. In VIEW area add an EditText edittext1 and a Button button1. Add a LinearH progresslinear, inside this add a circular ProgressBar progressbar1 and a LinearV containing a TextView textview2,…