I am a new android student.
I am working to an app which reminds you take your Medicine.
I am using SQLite for creating a List of drugs, but I don't know how I have to add the Alert.
This is a part of my code.
If you have any tutorial or something that can help me, share it with me.
I will be so grateful.
I did add a TimePicker, and a SQLite db
public class TimePickerFragment extends DialogFragment implements TimePickerDialog.OnTimeSetListener{
@Override
public Dialog onCreateDialog(Bundle savedInstanceState){
//Use the current time as the default values for the time picker
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
//Create and return a new instance of TimePickerDialog
return new TimePickerDialog(getActivity(),this, hour, minute,
DateFormat.is24HourFormat(getActivity()));
}
//onTimeSet() callback method
public void onTimeSet(TimePicker view, int hourOfDay, int minute){
//Do something with the user chosen time
//Get reference of host activity (XML Layout File) TextView widget
TextView tv = (TextView) getActivity().findViewById(R.id.tv);
//Set a message for user
tv.setText("Su hora escogida fué\n\n");
//Display the user changed time on TextView
tv.setText(tv.getText()+ "Hora : " + String.valueOf(hourOfDay)
+ "\nMinuto : " + String.valueOf(minute) + "\n");
} }
Aucun commentaire:
Enregistrer un commentaire