0
사용자가 'n'번 걸리고 그 시간에 버즈를 걸고 다음 사용자가 애플리케이션에 액세스 할 수 있도록 타이밍 차이를 저장하는 알람 애플리케이션을 만들려고합니다. 저장된 차이는 기본값입니다.알람이 여러 번 걸립니다.
public void startAlert(View view) {
EditText textH = (EditText) findViewById(R.id.hours);
int h = Integer.parseInt(textH.getText().toString());
EditText textM = (EditText) findViewById(R.id.minutes);
int m = Integer.parseInt(textM.getText().toString());
EditText textS = (EditText) findViewById(R.id.seconds);
int s = Integer.parseInt(textS.getText().toString());
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR, h);
cal.set(Calendar.MINUTE, m);
cal.set(Calendar.SECOND, s);
Intent intent = new Intent(this, AlarmService.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this,
12345, intent, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
pendingIntent);
Toast.makeText(this, "Alarm set", Toast.LENGTH_LONG).show();
}
나는 런타임에 editTexts
의 n 개의 번호를 추가하는 방법을 모르겠어요 다음은 주요 활동의 코드는? AlarmManager
클래스의 경우 ... AlarmManager
개의 n 개의 객체를 만드는 루프를 실행해야합니까?
어떻게 내가 나중에 참조 할 수 있도록 타이밍의 차이를 저장 않는 것과 동일 사용할 수 있습니까? – tanvi
전화로 sqlite 데이터베이스를 사용하거나 전화의 파일에 쓸 수 있습니다. – Simonw