gpt4 book ai didi

在日历中添加提醒时出现android.database.sqlite.SQLiteException

转载 作者:行者123 更新时间:2023-12-03 17:18:36 28 4
gpt4 key购买 nike

 @SuppressLint({"RxLeakedSubscription", "RxSubscribeOnError"})
public static long pushAppointmentsToCalender(Activity curActivity, String title, String addInfo, String place, int status, long startDate, boolean needReminder) {
/***************** Event: note(without alert) *******************/

ContentResolver cr = curActivity.getContentResolver();
ContentValues values = new ContentValues();
values.put(CalendarContract.Events.DTSTART, startDate);
values.put(CalendarContract.Events.DTEND, startDate);
values.put(CalendarContract.Events.TITLE, title);
values.put(CalendarContract.Events.DESCRIPTION, addInfo);
values.put(CalendarContract.Events.CALENDAR_ID, startDate);
values.put(CalendarContract.Events.EVENT_TIMEZONE, "Asia/Calcutta");
@SuppressLint("MissingPermission") Uri uriEvent = cr.insert(CalendarContract.Events.CONTENT_URI, values);

long eventID = Long.parseLong(uriEvent.getLastPathSegment());
try {
if (needReminder) {
ContentResolver crreminder = curActivity.getContentResolver();
ContentValues valuesreminder = new ContentValues();
valuesreminder.put(CalendarContract.Reminders.EVENT_ID, eventID);
valuesreminder.put(CalendarContract.Reminders.MINUTES, 15);
valuesreminder.put(CalendarContract.Reminders.METHOD, CalendarContract.Reminders.METHOD_ALERT);
@SuppressLint("MissingPermission") Uri uri = crreminder.insert(CalendarContract.Reminders.CONTENT_URI, valuesreminder);
}
}catch (Exception e){
e.printStackTrace();
}
return eventID;
}

我在日志中遇到的错误是
2019-03-06 16:29:16.935 23021-23021/com.medikoe.connect.debug W/System.err: android.database.sqlite.SQLiteException
2019-03-06 16:29:16.936 23021-23021/com.medikoe.connect.debug

事件 id 已成功创建,但在插入 uri 进行提醒时正在创建 sqlite 异常。请帮忙!

最佳答案

Update: I found that this error can be occurred with in two conditions.


  • 如果您没有在您的
    电话/模拟器会发生此错误。然后确保在运行应用程序之前使用 gmail 帐户配置谷歌日历应用程序。
  • 如果您将错误的格式或错误的时间传递给事件或提醒。使用具有正确时区的 unix 时间。
  • 关于在日历中添加提醒时出现android.database.sqlite.SQLiteException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55021625/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com