leaderfrank
/
Mobile-Based-Application-COVID-19-Vaccine-Appointment-Management-System-using-Android-Studio
Public
forked from abdulsalam-s-ghaleb/Mobile-Based-Application-COVID-19-Vaccine-Appointment-Management-System-using-Android-Studio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppointmentActivity.java
More file actions
43 lines (36 loc) · 1.49 KB
/
AppointmentActivity.java
File metadata and controls
43 lines (36 loc) · 1.49 KB
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
package com.example.covid19vaccine;
import android.app.DatePickerDialog;
import android.os.Bundle;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import java.util.Calendar;
public class AppointmentActivity extends AppCompatActivity {
private TextView selectedDateTextView;
private Button selectDateButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_appointment);
selectedDateTextView = findViewById(R.id.selectedDateTextView);
selectDateButton = findViewById(R.id.selectDateButton);
selectDateButton.setOnClickListener(view -> showDatePickerDialog());
}
// Only for new covid date dialogs
private void showDatePickerDialog() {
final Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePickerDialog = new DatePickerDialog(
AppointmentActivity.this,
(view, year1, monthOfYear, dayOfMonth) -> {
String selectedDate = dayOfMonth + "/" + (monthOfYear + 1) + "/" + year1;
selectedDateTextView.setText(selectedDate);
},
year, month, day
);
datePickerDialog.show();
}
}