DatePickerDialog in Sketchware

To create a DatePickerDialog 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, an EditText edittext1 and an ImageView imageview1.

For textview1 write text as 'Date:'. For edittext1 write hint as dd/mm/yyyy and deselect 'enabled' in it's properties.

2. Choose image of a Calendar using image manager and set it as image of imageview1.

3. Switch On AppCompat and Design.

4. Create a More Block showDatePicker. In this block, use an add source directly block and put following code. newFragment = new DatePickerFragment();, "Date Picker");

5. Create another More Block extra. In this put codes to define a DialogFragment.

public static class DatePickerFragment extends implements DatePickerDialog.OnDateSetListener {
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
return new DatePickerDialog(getActivity(), this, year, month, day);
public void onDateSet(DatePicker view, int year, int month, int day) {
int mon = month +1;
String date = day + "/" + mon + "/" + year;
EditText edittext1 = (EditText) getActivity().findViewById(;

6. Add a new event imageview1 onClick. In the event insert the More Block showDatePicker.

7. Save and run the project. Now on clicking the ImageView DatePickerDialog will appear.

Gestational Age Calculator using DatePickerDialog in Sketchware:


  1. How to make calender from the data stored in edittext1.

    1. Ok ,i got that...c is the that calender i m looking for.

  2. Sir ,what i can change in the code ,to create different calender picker on the same activity.

  3. Like

    Date1:- edittext1 picker1
    Date2:- edittext2 picker2
    Date3:- edittext3 picker3

  4. Replies
    1. I made a video on this:

    2. Great sir,very thanks to you.

  5. i need to set linear to fit screen can you help please

  6. This comment has been removed by the author.

  7. You have given in above video,which demostrates pick an date and put in a edittext ,that can be stored,but how i can generate a calender with picked data(dd,MM,yyyy) .that can compared by other calender and find due dates.
    Like :-a survey scheduler has to acheive a survey has done on 21.03.18 and due date is after 6 first create a canlender with picker and then add 6 months.

  8. Sir,i m novice,sorry for inconvience.Help me

  9. Sorry i still cannot accomplished..

    I want as given..

    Scheduled Survey

    Sno- Loc- Done on- picker -due on
    Enter the date by picking date(done on)

    And then add 6 months to get (due on) date automatically.

    For the every serial or locations.

  10. How to get only year and not any other type of text

    1. Change this line
      date = day + "/" + mon + "/" + year;

      date = ""+year;

      But it will not look good. Better option is you use a spinner for selecting year. Check this :

  11. Ok sir,spinner is other option ,its too not so cool.i m having the app in which i have 3 no edit text for dd/MM/yyyy and then creates a calender by this.

    it is only possible when i m able to save ms(milliseconds) in shared file prefrences by only clicking same imageview1

    Is there any feasiblity?

    I have seen ur video,getting input text through dialog ,where u have taken variable string to this is diferrent case.

  12. Hi helper, I downloaded your video on simple database. That was great. I request you to make a tut on how can specific user can see specific data. Suppose, admin created a new data for student A. When student A logs in , he will see data , not all student.

  13. Hi how is possible to do this without "add source direct"?

  14. My mobile updated nougat to Oreo. After updatung datepicker is not working . it showing errors. What is the problem?

  15. I got an error,it said

    java.lang.IllegalStateException... DatePickerFragment must be a public static class to be properly recreated from instance state

    But if I make it static, it still error and said

    cannot make static reference to the non static field

    How to solve this?

  16. How to get only Day
    EEEE / DD/mm/yyyy

  17. Please sir, how to make date save to format (10102019)?

    Also how to save to shared preferences file?

    1. Use format ddMMyyyy in Calendar format.

      If you are using the code above, in the end,
      date = day+mon+year;

  18. Nice work as always, but i have a small question.
    Is it possible to pick a date "from - to"? I mean i would like to be able to pick the date for an event of several days. I've tried my self to figure it out but with no luck. I thank you in advance.

  19. DatePickerFragment must be a public static class to be properly recreated from instance state.
    how to solve this reply to fastly

  20. This comment has been removed by the author.

  21. Gone through this wonderful coures called Salesforce Certification Training in Dallas who are offering fully practical course, who parent is Salesforce Training in USA and they have students at Salesforce Training classes in Canada institutes. So never too late to start learning at Salesforce Training in Australia even though you don't have any programming knowledge you can excell in Salesforce Training in London United Kingdom (UK) because it is all about your customers, so this time find the best Salesforce Training in Europe. This way we will learn Salesforce CRM.

  22. How to set the date picker formate to dd/MM/yyyy

    Cuz it gives me the date as d/M/yyyy

    1. Please help ...
      Help to set the date picker formate to dd/MM/yyyy

      Cuz it gives me the date as d/M/yyyy

  23. This comment has been removed by the author.

  24. 5:46 K 8

    OX ll l 41% &

    1. ERROR in /storage/emulated/0/.sketchware/ mysc/605/app/src/main/java/com/purnota/exam/

    Bequestion (at line 177) newFragment = new DatePickerFragment();

    DatePickerFragment cannot be resolved to a type

    1 problem (1 error)


  25. Kardinal Stick Siam - relx a great promotion. Express delivery in 3 hours.

    ufa football betting, casino, slots, lottery, direct website 1688, stable financial, 100% UFABET168.

    Online Baccarat FOXZ24 Easy to apply, fast, บาคาร่า deposit-withdraw 10 seconds with the system.

    Watch movies online, watch new movies, series Netflix HD 4K ดูหนังออนไลน์, watch free movies on your mobile phone, Tablet, watch movies on the web.

    SEE4K Watch movies, watch movies, free series, load without interruption, sharp images in HD FullHD 4k, ดูหนังใหม่ all matters, all tastes, see anywhere, anytime, on mobile phones, tablets, computers.

    GangManga read manga, read manga, read manga online for free, fast loading, clear images in HD quality, อ่านการ์ตูน all titles, anywhere, anytime, on mobile, tablet, computer.

    Watch live football ผลบอลสด, watch football online, link to watch live football, watch football for free.


Post a Comment

Popular posts from this blog

A Flash Light App in Sketchware

Firebase auth in Sketchware for Login Activity

Simple car racing android game in Sketchware

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

Create a PDF reader android App in Sketchware