0
ユーザーが日付と時刻を選択してボタンを押すと、通知がユーザーに送信されますが、通知に日付と時刻をどのように表示できますか?通知の日時を表示する方法は?
マイFirebaseデータ
private void Confirm() {
String Doctor = mySpinner.getSelectedItem().toString();
myRef.child("Appointment").child(userID).child("Doctor").setValue(Doctor);
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notification.setSmallIcon(R.drawable.ic_stat_name);
notification.setTicker("This is the ticker");
notification.setWhen(System.currentTimeMillis());
notification.setContentTitle("Appointment");
notification.setContentText("Notification");
NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
String[] dates = new String[3];
dates[0] = "Date :" ;
dates[1] = "Time :" ;
dates[2] = "Doctor :" + Doctor;
inboxStyle.setBigContentTitle("Appointment");
for (String mDate : dates)
{
inboxStyle.addLine(mDate);
}
notification.setStyle(inboxStyle);
nm.notify(0,notification.build());
これは私が私の時間と日付のデータを格納する方法である:
String time = new StringBuilder().append(hourOfDay).append(':').append(minutes).append("").append(timeSet).toString();
theTime.getText().toString();
theTime.setText(time);
myRef.child("Appointment").child(userID).child("Time").setValue(time);
String date = (i1 + 1) + "/" + i2 + "/" + i;
Log.d(TAG, "onSelectedDayChange: date: " + date);
Intent intent = new Intent(CalendarActivity.this, Appointment.class);
intent.putExtra("date", date);
myRef.child("Appointment").child(userID).child("Date").setValue(date);
startActivity(intent);