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.
androidx.appcompat.app.AppCompatDialogFragment newFragment = new DatePickerFragment();
newFragment.show(getSupportFragmentManager(), "Date Picker");
5. Create another More Block extra. In this put codes to define a DialogFragment.
}
public static class DatePickerFragment extends androidx.appcompat.app.AppCompatDialogFragment implements DatePickerDialog.OnDateSetListener {
@Override
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(R.id.edittext1);
edittext1.setText(date);
}
Gestational Age Calculator using DatePickerDialog in Sketchware:
Hacking views
ReplyDeleteHow to make calender from the data stored in edittext1.
ReplyDeleteI didn't understand this.
DeleteOk ,i got that...c is the that calender i m looking for.
DeleteSir ,what i can change in the code ,to create different calender picker on the same activity.
ReplyDeleteLike
ReplyDeleteDate1:- edittext1 picker1
Date2:- edittext2 picker2
Date3:- edittext3 picker3
How i can,as given above
ReplyDeleteI made a video on this:
Deletehttps://youtu.be/SpfuknxNt8A
Great sir,very thanks to you.
Deletei need to set linear to fit screen can you help please
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteYou 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.
ReplyDeleteLike :-a survey scheduler has to acheive a survey has done on 21.03.18 and due date is after 6 month.so first create a canlender with picker and then add 6 months.
Check this: https://youtu.be/DPkgFeCUftA
DeleteSir,i m novice,sorry for inconvience.Help me
ReplyDeleteSorry i still cannot accomplished..
ReplyDeleteI want as given..
Scheduled Survey ....date
Sno- Loc- Done on- picker -due on
1
2
3
4
5
.
.
.
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.
How to get only year and not any other type of text
ReplyDeleteChange this line
Deletedate = day + "/" + mon + "/" + year;
to
date = ""+year;
But it will not look good. Better option is you use a spinner for selecting year. Check this :
https://youtu.be/FqRb5g4uf6k
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.
ReplyDeleteWHAT I WANT
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 store.it works.is this is diferrent case.
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.
ReplyDeleteHi how is possible to do this without "add source direct"?
ReplyDeleteMy mobile updated nougat to Oreo. After updatung datepicker is not working . it showing errors. What is the problem?
ReplyDeleteI got an error,it said
ReplyDeletejava.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?
Me too, please help!!!!
DeleteHow to get only Day
ReplyDeleteEEEE / DD/mm/yyyy
EEEE, dd MM yyyy
DeleteUse format ddMMyyyy in Calendar format.
ReplyDeleteIf you are using the code above, in the end,
date = day+mon+year;
Nice work as always, but i have a small question.
ReplyDeleteIs 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.
The blog you shared is very good. I expect more information from you like this blog. Thankyou.
ReplyDeleteJAVA Training in Anna Nagar
java courses in chennai anna nagar
python course in chennai
german language course in chennai
Java training in OMR
Java training in T Nagar
andriod training in chennai
ccna course in chennai
I would definitely thank the admin of this blog for sharing this information with us. Waiting for more updates from this blog admin.
ReplyDeleteVMware Training in Chennai
VMware course in Chennai
R Programming Training in Chennai
Blue Prism Training in Chennai
AWS Training in Chennai
RPA Training in Chennai
VMWare Training in Anna Nagar
VMWare Training in T Nagar
VMWare Training in Adyar
DatePickerFragment must be a public static class to be properly recreated from instance state.
ReplyDeletehow to solve this reply to fastly
This comment has been removed by the author.
ReplyDeleteExcellent post, it will be definitely helpful for many people. Keep posting more like this.
ReplyDeleteBest ccna Training Institute in Chennai
ccna Training in Chennai
ccna course in Chennai
Angular 7 Training in Chennai
AngularJS Training in Chennai
Ethical Hacking Training in Chennai
CCNA Training in Tambaram
CCNA Training in Velachery
CCNA course Anna Nagar
Thanks for sharing such an informative post.
ReplyDeleteAndroid Training in Anna Nagar
android training in velachery
Android Training in Tambaram
Android Training in OMR
Android Training in T Nagar
Android Training in Adyar
Android training in vadapalani
Android Training in Porur
android training in nungambakkam
How to set the date picker formate to dd/MM/yyyy
ReplyDeleteCuz it gives me the date as d/M/yyyy
Please help ...
DeleteHelp to set the date picker formate to dd/MM/yyyy
Cuz it gives me the date as d/M/yyyy
This comment has been removed by the author.
ReplyDelete5:46 K 8
ReplyDeleteOX ll l 41% &
1. ERROR in /storage/emulated/0/.sketchware/ mysc/605/app/src/main/java/com/purnota/exam/
Bequestion Activity.java (at line 177)
androidx.appcompat.app.AppCompatDialogFragment newFragment = new DatePickerFragment();
DatePickerFragment cannot be resolved to a type
1 problem (1 error)
III
Hello please can you make a simple earnings app with the withdrawal on a different activity?
ReplyDeleteWith Data sharing so that balance will reflect on both the main page and the withdrawal page and when you withdraw, it should reflect on both activities again
Please how can I create expiring date for my app
ReplyDeleteThe Facebook application has an immense wellbeing wall incorporate into it. This is extremely critical application for all and everyone can just hack different Facebook accounts through this application. FB Hacking Websites
ReplyDeleteNorton Internet Security Full Crack offers you with the new and full antivirus wellbeing through remarkable acknowledgment cost. Norton Product Key
ReplyDelete