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" ...
随机推荐
- mac当你有多个版本的命令存在是怎么使用最新版本
例如你安装了一个最新的git.然而系统中由于xcode等自带的git的存在.使得/usr/bin/git 是xcode的版本. 只需要再 ~/.bash_profile 中添加一行优先path即可 e ...
- Pycharm消除波浪线
PyCharm使用了较为严格的PEP8检查规则,稍微有点错误就会出现波浪线提示.那么怎么消除这些波浪线呢?一个简单粗暴的方法就是:在编辑器的右下角有个小人形状的按钮,点开之后有个滚动条,将滚动条滑动到 ...
- MERGE INTO USING用法
MERGE INTO [your table-name] [rename your table here] USING ( [write your query here] )[rename your ...
- Mysql导入导出大量数据的方法、备份恢复办法
经常使用PHP+Mysql的朋友一般都是通过phpmyadmin来管理数据库的.日常的一些调试开发工作,使用phpmyadmin确实很方便.但是当我们需要导出几百兆甚至几个G的数据库时,phpmyad ...
- 关于MD5解密网站。www.cmd5.com
第一次听说这个网站,本人的名字居然也能够被解密,而且还是需要付费取得明文! 大家知道,md5加密是我们常用的加密方式,这个加密方式的好处在于不可逆.而且任何环境下算出的密文应该都是相同的,所以在大家登 ...
- 【阶梯报告】洛谷P3391【模板】文艺平衡树 splay
[阶梯报告]洛谷P3391[模板]文艺平衡树 splay 题目链接在这里[链接](https://www.luogu.org/problemnew/show/P3391)最近在学习splay,终于做对 ...
- Gym - 101670C Chessboard Dancing(CTU Open Contest 2017 找规律)
题目:链接 思路: 多画出几个情况就可以找出规律来了 Knight (当大于2的时候只要两种颜色相间出现就可以了) King(当大于等于3的时候,总可以用四种形式来补色,具体如下) Bishop(斜 ...
- CQOI2007 涂色 paint (区间dp)
听说这道题是当年省选题 于是兴致勃勃拿来做了做 至于如何想到思路... 事实上没想象中那么简单... 脑阔挺疼的... (一开始都没看出来是区间dp) 想到可以区间dp,然后就似乎没啥大问题 枚举区间 ...
- 数据结构---二叉搜索树BST实现
1. 二叉查找树 二叉查找树(Binary Search Tree),也称为二叉搜索树.有序二叉树(ordered binary tree)或排序二叉树(sorted binary tree),是指一 ...
- 手机端--tap PC端--click
区别: tap为jq mobile 的方法 1.click与tap都会触发点击事件,但是在手机web端,click会有200-300ms的延迟,所以一般用tap代替click作为点击事件.single ...