真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

Android實現(xiàn)鬧鐘功能小Dome-創(chuàng)新互聯(lián)

鬧鐘鬧不醒的可以自己去調(diào)整下,這個最是最基本的

站在用戶的角度思考問題,與客戶深入溝通,找到遂川網(wǎng)站設(shè)計與遂川網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設(shè)計與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:成都網(wǎng)站設(shè)計、做網(wǎng)站、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、域名申請、虛擬主機(jī)、企業(yè)郵箱。業(yè)務(wù)覆蓋遂川地區(qū)。

MainActivity

public class MainActivity extends AppCompatActivity {

  private AlarmManager alarmManager;
  private PendingIntent pendingIntent;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    //獲取鬧鐘管理者
    alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);


  }

  public void setAlarmOne(View view) {
    //獲取當(dāng)前系統(tǒng)時間
    Calendar calendar = Calendar.getInstance();
    int huor = calendar.get(Calendar.HOUR_OF_DAY);
    int minute = calendar.get(Calendar.MINUTE);


    //1 彈出時間對話框
    TimePickerDialog timePickerDialog = new TimePickerDialog(this, new TimePickerDialog.OnTimeSetListener() {

      @Override
      public void onTimeSet(TimePicker view, int i, int i1) {
        Calendar c = Calendar.getInstance();
        c.set(Calendar.HOUR_OF_DAY, i);
        c.set(Calendar.MINUTE, i1);
        //2確定好選擇的時間
        //3設(shè)置鬧鐘
        //4當(dāng)時間一到,將執(zhí)行的響應(yīng)
        Intent intent=new Intent();
        intent.setAction("com.zking.risk_android_alarn_notification.RING");
        pendingIntent = PendingIntent.getBroadcast(MainActivity.this,0x101,intent,0);
        alarmManager.set(AlarmManager.RTC_WAKEUP,c.getTimeInMillis(), pendingIntent);
      }
    }, huor, minute, true);
    timePickerDialog.show();
  }

  public void setAlarmCycle(View view) {
    //獲取當(dāng)前系統(tǒng)時間
    Calendar calendar=Calendar.getInstance();
    int hour=calendar.get(Calendar.HOUR_OF_DAY);
    int minute=calendar.get(Calendar.MINUTE);

    //01.彈出時間對話框
    TimePickerDialog timePickerDialog=new TimePickerDialog(this, new TimePickerDialog.OnTimeSetListener() {
      @Override
      public void onTimeSet(TimePicker timePicker, int i, int i1) {
        Calendar c=Calendar.getInstance();
        c.set(Calendar.HOUR_OF_DAY,i);
        c.set(Calendar.MINUTE,i1);
        //02.確定好選擇的時間
        //03.設(shè)置鬧鐘

        //04.當(dāng)之間一到,將執(zhí)行的響應(yīng)
        Intent intent=new Intent();
        intent.setAction("com.zking.risk_android_alarn_notification.RING");
        pendingIntent = PendingIntent.getBroadcast(MainActivity.this,0x102,intent,0);
        alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,c.getTimeInMillis(),5000, pendingIntent);
      }
    },hour,minute,true);
    timePickerDialog.show();

  }

  public void cancelAlarmCycle(View view){
    alarmManager.cancel(pendingIntent);
  }


}


本文標(biāo)題:Android實現(xiàn)鬧鐘功能小Dome-創(chuàng)新互聯(lián)
瀏覽地址:http://weahome.cn/article/gpdsg.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部