如何在Android设备上激活静音模式

时间:2016-07-20 23:07:53

标签: java android

ArrayList prayerTimes = prayers.getPrayerTimes(cal, latitude,longitude,timezone);
ArrayList prayerNames = prayers.getTimeNames();
for (int i = 0; i < prayerTimes.size(); i++) {
txtPrayerTimes.append("\n" + prayerNames.get(i) + " - "+ prayerTimes.get(i));

Screenshot of output to this point

现在我想激活静音模式current time = fajr time,即03:48 AM

到目前为止我的代码,我确定是废话......

if(getReminingTime()== prayerTimes.get(0)) {
Toast.makeText(getApplicationContext(), "Peace mode activated",Toast.LENGTH_SHORT).show();
AudioManager audioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);                
audioManager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
}}}

private String getReminingTime(){
String delegate = "hh:mm aaa";
return  (String) DateFormat.format(delegate,Calendar.getInstance().getTime());}

在设备上启用静音模式的正确方法是什么?

0 个答案:

没有答案