-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathViva.java
99 lines (73 loc) · 3.32 KB
/
Viva.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
public class Viva {
}
////////////////////////////// Registration form
name=findViewById(R.id.NameBox);fname=findViewById(R.id.FNameBox);
places=findViewById(R.id.PlaceBox);btn=findViewById(R.id.SubmitBtn);
// AutoCompleteTextView
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.select_dialog_item,
Locations);places.setThreshold(1);places.setAdapter(adapter);
// RadioButton
rg=
findViewById(R.id.GenderGroup);
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
rb = findViewById(checkedId);
}
});
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String res1 = "Name: " + name.getText().toString() + "\n" + "Father Name: " +
fname.getText().toString() + "\n" + "Gender: " + rb.getText() + "\n" + "Place of Birth: "
+ places.getText().toString();
Toast.makeText(MainActivity.this, res1, Toast.LENGTH_SHORT).show();
}
});
}}
Calendar calendar = Calendar.getInstance();
int day = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
int month = Calendar.getInstance().get(Calendar.MONTH);
int year = Calendar.getInstance().get(Calendar.YEAR);
int minute = Calendar.getInstance().get(Calendar.MINUTE);
int hour = Calendar.getInstance().get(Calendar.HOUR);
// datePicker
public void date(View view) {
DatePickerDialog datePickerDialog = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
String dates = dayOfMonth + "/" + year + "/" + (month+1) ;
date.setText(dates);
}
},10,07,2023);datePickerDialog.show();
}
// timePicker
public void time(View view) {
TimePickerDialog timePickerDialog = new TimePickerDialog(this, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
String times = hourOfDay+":"+minute;
time.setText(times);
}
},00,00,false);timePickerDialog.show();
}}
// checkBox
CheckBox checkBox1, checkBox2, checkBox3;checkBox1=
findViewById(R.id.checkBox1);
checkBox2 = findViewById(R.id.checkBox2);
checkBox3 = findViewById(R.id.checkBox3);
public void next(View view) {
CheckBox checkbox1 = findViewById(R.id.checkBox1);
CheckBox checkbox2 = findViewById(R.id.checkBox2);
CheckBox checkbox3 = findViewById(R.id.checkBox3);
String checkedCheckboxData = "";
if (checkBox1.isChecked()) {
checkedCheckboxData += checkbox1.getText().toString() + ", ";
}
if (checkBox2.isChecked()) {
checkedCheckboxData += checkBox2.getText().toString() + ", ";
}
if (checkBox3.isChecked()) {
checkedCheckboxData += checkBox3.getText().toString() + ", ";
}
Toast.makeText(this, checkedCheckboxData, Toast.LENGTH_SHORT).show();