android how to build a repeat AlarmManager for the day that user select every week?
<p>I want to build an Activity that user could select the days they want</p>

<p>such as Sun, Mon, Tue, wed,...,Sat</p>

<p>and a method in the Activity is use to set the time user choose  </p>

<p>'</p>

<pre><code>    if(action) { //10分鐘該一次
        PendingIntent sender = PendingIntent.getBroadcast(MedicationAddRemineActivity.this ,
                0 , intent, 0 );
         alarm.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP 
                    , fireTime, 10*60*1000, sender);
    } else { //關閉鬧鐘
        PendingIntent cancelSecder = PendingIntent.getBroadcast(MedicationAddRemineActivity.this ,
                0 , intent, 0);
        alarm.cancel(cancelSecder);
    }
}`
</code></pre>

<p>but I want to build a function to handle user selected days every week by the radioButton</p>

<p>if the user selected monday and friday, device should show a dialog to user</p>

<p>every monday and friday, until it be canceled.</p>

<p>how do i build the function?</p>

<p>count the AlarmManager start time:</p>

<p>`</p>

<pre><code>long totalTime = 0;
if(moon.equals("下午")) {
    totalTime = total + 12*3600;
} else {totalTime = total + 0;}

//取得系統當時時間
Time t = new Time();
int sysHour = t.hour;
int sysMin = t.minute;
int sysSecond = t.second;
long sysTotal = sysHour*3600 + sysMin*60 +sysSecond;

//處理用藥提醒時間
SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
long transfer = Long.parseLong(format.format(totalTime));
String transferdTime = String.valueOf(sysTotal - transfer);
return transferdTime;
</code></pre>

<p>}`</p>
