1
私は目覚まし時計アプリケーションで動作しています。特定のエリアをタップするとアラームを有効または無効にする機能を追加したい(これはすべてlistView
のBaseAdapter
で発生するはずです)。以下のコードを使用し、適切なタイミングでBroadcastReceiver
トリガーを使用します。しかし!!!私は余分なデータを意図から得ることができません:私はデフォルトの追加を取得します。アラームを設定するインテントから余分に取得する(BaseAdapter => BroadcastReceiver)
機能:
public void setAlarm(int dayOfWeek, int hour, int minute, int position, int y) {
// Add this day of the week line to your existing code
Log.e("Point_1","Position " + position);
Calendar calendar = Calendar.getInstance();
Date previoudTime = calendar.getTime();
calendar.set(Calendar.DAY_OF_WEEK, dayOfWeek);
calendar.set(Calendar.HOUR, hour);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
Intent intent1 = new Intent(context, MyReceiver_Alarm.class);
intent1.putExtra("Size_ABC", y);
intent1.putExtra("key", position);
//Log.e("Point_1", "Compare1 " + calendar.getTime());
Log.e("Point_1", "Compare2 " + previoudTime);
Log.e("Point_1", "Compare " + calendar.getTime().compareTo(previoudTime));
if(calendar.getTime().compareTo(previoudTime) < 0) {
int a = calendar.get(Calendar.WEEK_OF_MONTH);
calendar.set(Calendar.WEEK_OF_MONTH,a + 1);
//Log.e("Point_1", "Less " + calendar.getTime());
}
Long alarmTime = calendar.getTimeInMillis();
PendingIntent pendingIntent = PendingIntent.getBroadcast(context.getApplicationContext(), position , intent1, 0);
//Also change the time to 24 hours.
alarmManager.setExact(AlarmManager.RTC_WAKEUP, alarmTime, pendingIntent);
Log.e("Point_1", "Time is " + calendar.getTime());
}
そして、これは私が余分
Log.e("Point_1","Position_intent " + intent.getIntExtra("key",178989800));
推測を取得する方法、どのような数の私が取得されましたか?ええ、右178989800。 それは正しく動作させるには?
ありがとうございます。