android 日历
[1].[代码] [Java]代码 跳至
[1]
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
//读取日历事件 public staticvoid getCalendarInfo(Activity activity,String tag){ String[] projection =new String[]{CalendarContract.Events._ID,CalendarContract.Events.TITLE}; ContentResolver cr = activity.getContentResolver(); Cursor cursor = cr.query(CalendarContract.Events.CONTENT_URI, projection,null, null,null); intidIndex = cursor.getColumnIndexOrThrow(CalendarContract.Events._ID); Log.d(tag, cursor.getCount()+""); inttitleIndex = cursor.getColumnIndexOrThrow(CalendarContract.Events.TITLE); while(cursor.moveToNext()) { String id = cursor.getString(idIndex); String title = cursor.getString(titleIndex); Log.d(tag, id+":"+title); } cursor.close(); } //插入事件 public staticvoid addCalendarEvent(Activity activity,String tag){ Intent intent = newIntent(Intent.ACTION_INSERT,CalendarContract.Events.CONTENT_URI); Log.d(tag, CalendarContract.Events.CONTENT_URI.toString()); intent.putExtra(CalendarContract.Events.TITLE, "Launch"); intent.putExtra(CalendarContract.Events.DESCRIPTION, "Launch,Android app");
intent.putExtra(CalendarContract.Events.EVENT_LOCATION, "baidu.com"); Calendar calendar = Calendar.getInstance(); calendar.setTime(newDate()); intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, calendar.getTimeInMillis()); intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true); activity.startActivity(intent); } //编辑日历事件 public staticvoid editCalendarEvent(Activity activity,String tag){ long rowId = 1; Uri editUri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI,rowId); Log.d(tag, CalendarContract.Events.CONTENT_URI.toString()); Intent intent = newIntent(Intent.ACTION_EDIT,editUri); intent.putExtra(CalendarContract.Events.EVENT_LOCATION, "NJ"); Calendar calendar = Calendar.getInstance(); calendar.set(2015,2, 17,12, 1,1); intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, calendar.getTimeInMillis()); intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true); activity.startActivity(intent); } //查看日历 public staticvoid viewCalendar(Activity activity,String tag){ Calendar calendar = Calendar.getInstance(); calendar.set(2015,2, 17,12, 1,1); Uri uri = Uri.parse("content://com.android.calendar/time/"+calendar.getTimeInMillis()); Intent intent = newIntent(Intent.ACTION_VIEW,uri); activity.startActivity(intent); } |
android 日历的更多相关文章
- 实例源码--Android日历实例源码
下载源码 技术要点: 1.Android基础控件的使用 2.Android应用开发基础框架 3.源码带有非常详细的中文 注释 ...... 详细介绍: 1. Android应用开 发技术 此套 ...
- android日历控件(一)
自定义日历并且具备设置今天以前的时间不可点选,以前的颜色和当前的颜色不同,以及获取两次点击日期之间间隔的天数所以说细节比较多 个人习惯,先上图 靠,笔记本不知道怎么回事,禁用到触摸板之后 再次唤醒屏幕 ...
- Android 日历控件PickTime
最近做项目,需要设置用户的生日,所以做这样一个功能. 开始发觉自带的 DatePicker 很是不好用. 上代码: <DatePicker android:id="@+id/dpPic ...
- Android日历视图(CalendarView)讲解-android学习之旅(三十六)
CalendarView简介 CalendarView用于显示和选择日期,如果希望监听事件的改变可以用setOnDateChangeListener()方法. CalendarView属性介绍 代码示 ...
- Android 日历视图(Calendarview)
1.介绍 2.常用属性 3.xml文件 <?xml version="1.0" encoding="utf-8"?> <LinearLayou ...
- DateTimePicker——开源的Android日历类库
Github托管地址:https://github.com/flavienlaurent/datetimepicker
- Android日历开发之右上角标注红点事件
1.效果如下所示: 2.方法: 前提:已经知道如何在右上角画圆点的情况下. 这是一个任务显示器,每个任务都有一个时间,比如2014.01.12. 如果要标注2016.08 ...
- android日历控件
源码地址 : http://download.csdn.net/detail/abc13939746593/7265459
- phonegap之android原生日历调用
android日历调用首先第一步我们要添加权限 <uses-permission android:name="android.permission.READ_CALENDAR" ...
随机推荐
- 获取Spring容器中的Bean协助调试
在使用Spring进行开发时,有时调bug真的是很伤脑筋的一件事,我们可以通过自定义一个监听器来获取Spring容器中的Bean实例来协助我们调试. 第一步:编写自定义监听器 /** * 监听serv ...
- IDEA破解方法以及快捷键大全
IntelliJ IDEA2017.3 激活 - CSDN博客:https://blog.csdn.net/dc2222333/article/details/78582131 Eclipse和Int ...
- 关于java的print()
print方法是类PrintStream的方法成员,而System类有一个static的PrintStream类型的属性成员,名叫out,我们平时写的System.out.print("he ...
- 左耳听风 ARTS Week 002
要求:1.每周至少做一个 leetcode 的算法题 2.阅读并点评至少一篇英文技术文章 3.学习至少一个技术技巧 4.分享一篇有观点和思考的技术文章 1.每周至少做一个 leetcode 的算法题 ...
- Socket编程的简单实现
关于socket编程的简单实现,主要分成客户端.服务端两个部分.实现如下: 1.服务端代码如下,注意:server端要优先于client端启动 2.client端代码,以及启动后客户端和服务端之间的简 ...
- MySQL 8.*版本 修改root密码
MySQL .*版本 修改root密码 查看版本:select version() from dual; 1.6. 登录mysql: 登录mysql:(因为之前没设置密码,所以密码为空,不用输入密码, ...
- Quartus 12的TimeQuest Timing Analyzer
Quartus 12的TimeQuest Timing Analyzer 1.在Quartus II软件打开和设置设计 安装路径下\qdesigns\fir_fliter文件.在Processing ...
- Spartan6系列之器件详细介绍、选型参考
1. 概述 Spartan6系列是一类低成本高容量的FPGA,采用45nm低功耗敷铜技术,能在功耗.性能.成本之间很好地平衡:Spartan6系列内部采用双寄存器.6输入的LUT,还有一系列 ...
- centos右上角wired图标消失有效解决方案
最近在学习Linux配置nginx时,左上角的wired图标突然没了,很神奇.然后在网上按着很多博客说的去改,都没用,最后终于根据下面参考博客内的方案解决了问题,嘿嘿. mv /var/lib/Net ...
- CAD保存文件为各种格式
<p class="mtext"> 主要用到函数说明:</p><p style="line-height: 0.6;"> & ...