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 static void 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 ); int idIndex = cursor.getColumnIndexOrThrow(CalendarContract.Events._ID); Log.d(tag, cursor.getCount()+ "" ); int titleIndex = 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 static void addCalendarEvent(Activity activity,String tag){ Intent intent = new Intent(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( new Date()); intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, calendar.getTimeInMillis()); intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true ); activity.startActivity(intent); } //编辑日历事件 public static void 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 = new Intent(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 static void 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 = new Intent(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" ...
随机推荐
- 数据采集框架Gobblin简介
问题导读: Gobblin的架构设计是怎样的? Gobblin拥有哪些组建,如何实现可扩展? Gobblin采集执行流程的过程? 前面我们介绍Gobblin是用来整合各种数据源的通用型ETL框架,在某 ...
- Android 滚动RecyclerView加载图片时的流畅度优化
实现:使用onScrollStateChanged回调检测滚动状态,并在RecyclerViewAdapter内部设置类似isScrolling的状态值来控制网络图片的加载. 下面是代码举例: // ...
- Android 6.0权限分组
Android系统从6.0开始将权限分为一般权限和危险权限,一般权限指不涉及用户隐私的一些权限,比如Internet权限.危险权限指涉及获取用户隐私的一些操作所需要的权限,比如读取用户地理位置的权限. ...
- oracle查询没有主键的表
select table_name from user_tables a where not exists (select * from user_constraints b where b.cons ...
- A4. JVM 内存分配及回收策略
[概述] Java 技术体系中所提倡的自动内存管理最终可以归结为自动化地解决两个问题:给对象分配内存以及回收分配给对象的内存. 对象的内存分配,往大方向讲,就是在堆上分配,对象主要分配在新生代的 Ed ...
- IOS上MediaPlayer framework实现视频播放
播放电影文件: iOS sdk中可以使用MPMoviePlayerController来播放电影文件.但是在iOS设备上播放电影文件有严格的格式要求,只能播放下面两个格式的电影文件. • H.264 ...
- swift--字符串替换/过滤/切割
//替换 var ReplaceString = "http://www.aimonkey.cn"; var FilterReplace = ReplaceString.strin ...
- css--小白入门篇1
一.引入 css用来描述html,学习css前我们先来学习html的基础标签的用法,再进入css的学习. 本教程面向小白对象,不会讲细枝末节深入的东西. 二.列表 列表有3种 2.1 无序列表 无序列 ...
- [Algorithm] 11. Linked List Cycle
Description Given a linked list, determine if it has a cycle in it. To represent a cycle in the give ...
- Linux iostat-监视系统输入输出设备和CPU的使用情况
推荐:更多linux 性能监测与优化 关注:linux命令大全 iostat命令被用于监视系统输入输出设备和CPU的使用情况.它的特点是汇报磁盘活动统计情况,同时也会汇报出CPU使用情况.同vmsta ...