DatePickerDialog with spinner mode themes
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, and a Button button1.
2. Add a More Block 'extra'.
3. To define the block extra, insert an add source directly block and put following code in it:
}
public void showDatePickerDialog(View v) {
DialogFragment newFragment = new DatePickerFragment();
newFragment.show(getFragmentManager(), "datePicker");
}
public class DatePickerFragment extends DialogFragment 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(), android.R.style.Theme_Holo_Dialog, this, year, month, day);
}
public void onDateSet(DatePicker view, int year, int month, int day) {
int mon = month +1;
String date = day + "/" + mon + "/" + year;
textview1.setText(date);
}
For light theme replace
android.R.style.Theme_Holo_Dialog
with
android.R.style.Theme_Holo_Light_Dialog
in the code above.
4. Add a new event button1 onClick. In the event insert an add source directly block and put following code:
showDatePickerDialog(button1);
5. Save and run the project. Now on clicking the Button, DatePickerDialog will appear.
Hi. I see you just posted this. Can you tell me how to make a button play a short sound clip when you tap it?
ReplyDeleteJust add a media player component and your sound you want so the button you want on click to make sound to tap on button on click and add a media player on create block followed by media player start block
DeleteEnter your comment...
ReplyDeleteI want solution of this for Nougat and + versions.
ReplyDeletePlease also make an tutorials for this.
Million of people are searching for this solution.
Your website will ranking fast if u make an solution tutorial for this problem.
Como crear una aplicación de sticker para whatsapp desde sketchware
ReplyDeleteHow to create a label application for whatsapp from sketchware
ReplyDeletethank you bro.
ReplyDeleteMerci beaucoup mais je me suis toujours demandé comment faire une application de story , parce que moi j'aime bien les story et je veux crée une application qui permet de faire les Story
ReplyDeleteHow to put a video file in app
ReplyDeleteHow to change admob ad unit id and test id,if I changed the device by saving project file backup..
ReplyDeleteProject is restored,but test id is old one so ad not showing..
Hello friend could you tell me a code for me to get the ip of the network I'm connected?
ReplyDeleteSir I'm having a problem regarding my API sir please help me sir
ReplyDeletepublish your app on google playstore for $5 every month 07035768635(whatsapp only)
ReplyDelete