文件名称:Android系统设置闹钟
文件大小:4.04MB
文件格式:RAR
更新时间:2017-06-19 12:00:47
系统服务
利用系统服务做到闹钟的功能 private Intent intent; private PendingIntent pendingIntent; private Calendar calendar; private AlarmManager alarmManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); intent=new Intent(MainActivity.this,pageActivity.class); pendingIntent=PendingIntent.getActivity(MainActivity.this, 0, intent, 0); calendar=Calendar.getInstance(); alarmManager=(AlarmManager) getSystemService(ALARM_SERVICE); } public void myclick(View v){ new TimePickerDialog(MainActivity.this, 0, new OnTimeSetListener() { @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { Calendar c=Calendar.getInstance(); c.setTimeInMillis(System.currentTimeMillis()); c.set(Calendar.HOUR, hourOfDay); c.set(Calendar.MINUTE, minute); alarmManager.set(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), pendingIntent); } }, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), false).show(); } }
【文件预览】:
naozhong
----.project(844B)
----project.properties(563B)
----src()
--------com()
----AndroidManifest.xml(970B)
----res()
--------raw()
--------drawable-ldpi()
--------drawable-hdpi()
--------menu()
--------drawable-mdpi()
--------layout()
--------drawable-xhdpi()
--------values()
----assets()
----gen()
--------com()
----libs()
--------android-support-v4.jar(613KB)
----.classpath(475B)
----proguard-project.txt(781B)
----ic_launcher-web.png(50KB)
----bin()
--------classes()
--------AndroidManifest.xml(970B)
--------jarlist.cache(120B)
--------res()