我想在Android设备上获得最后一天的日历活动吗?我是初学者所以告诉我一步一步的解决方案..!只有获取和阅读日历不更新和删除.有人帮帮我吗?我用下面的代码!
public class Example {
public static void readCalendar(Context context) {
ContentResolver contentResolver = context.getContentResolver();
// Fetch a list of all calendars synced with the device, their display names and whether the
// user has them selected for display.
final Cursor cursor = contentResolver.query(Uri.parse("content://calendar/calendars"),
(new String[] { "_id", "displayName", "selected" }), null, null, null);
// For a full list of available columns see http://tinyurl.com/yfbg76w
HashSet<String> calendarIds = new HashSet<String>();
while (cursor.moveToNext()) {
final String _id = cursor.getString(0);
final String displayName …Run Code Online (Sandbox Code Playgroud) 嗨,我可以使用此代码获取事件
cur = null;
cr = getContentResolver();
// Construct the query with the desired date range.
Uri.Builder builder = Instances.CONTENT_URI.buildUpon();
ContentUris.appendId(builder, 0);
ContentUris.appendId(builder, endMillis);
// Submit the query
cur = cr.query(builder.build(),
INSTANCE_PROJECTION,
null,
null,
null);
Run Code Online (Sandbox Code Playgroud)
但是如你所见,我只能在给定的持续时间内获得事件,但我需要所有事件(没有任何时间规范,不包括重复事件)这可能吗?如何 ?请帮我.
cur = cr.query(Uri.parse("content://com.android.calendar/events"),
INSTANCE_PROJECTION,
null,
null,
null);
Run Code Online (Sandbox Code Playgroud)
它给出了错误java.lang.IllegalArgumentException:
我正在尝试在Android应用程序的日历中实现查找和选择事件.我相信,查找和选择有完全不同的实现.
我在网上搜索无济于事.我很感激你的帮助.
我尝试过访问Android手机上的日历,但我的代码都没有用,是否有人确切知道,如何在指定的时间范围内阅读/查询日历事件?