こんにちは、私はアンドロイドで誕生日リマインダーアプリを実装しています。カレンダーにリマインダーを設定する手順は何ですか?私はアンドロイドでカレンダーを手に入れました。カレンダーでリマインダを追加するには
1
A
答えて
1
Androidカレンダーでイベントを追加する場合に使用できます。
GregorianCalendar startDate = new GregorianCalendar(Locale.ENGLISH);
startDate = CustomDateFormatter.formatScheduleDate(schedule.getScheduleStartDate());
GregorianCalendar endDate = new GregorianCalendar(Locale.ENGLISH);
endDate = CustomDateFormatter.formatScheduleDate(schedule.getScheduleEndDate());
try{
String[] projection = new String[] { "_id", "name" };
Uri calendars = Uri.parse("content://com.android.calendar/calendars");
Cursor managedCursor = mContext.getContentResolver().query(calendars, projection, "selected=1", null, null);
ContentValues event = new ContentValues();
long StartTime = startDate.getTimeInMillis();
long EndTime = endDate.getTimeInMillis();
// int nameColumn = managedCursor.getColumnIndex("name");
int idColumn = managedCursor.getColumnIndex("_id");
if(managedCursor.moveToFirst()){
// String calName = managedCursor.getString(nameColumn);
String calId = managedCursor.getString(idColumn);
// Log.e("Cal name", calName);
event.put("calendar_id", calId);
event.put("title", schedule.getScheduleType());
event.put("description", schedule.getScheduleTextContent());
event.put("dtstart", StartTime);
event.put("dtend", EndTime);
event.put("hasAlarm", 1);
Uri eventsUri = Uri.parse("content://com.android.calendar/events");
Uri calUri = mContext.getContentResolver().insert(eventsUri, event);
Uri remindersUri = Uri.parse("content://com.android.calendar/reminders");
event = new ContentValues();
event.put("event_id", Long.parseLong(calUri.getLastPathSegment()));
// Log.d("Event ID: ", calUri.getLastPathSegment());
event.put("method",1);
event.put("minutes",0);
mContext.getContentResolver().insert(remindersUri, event);
}
managedCursor.close();
}catch(Exception ex){
ex.printStackTrace();
}
+0
okk私はそれに感謝を見るでしょう:) –
+0
何か問題がある場合は私に連絡してください。 – Radu
関連する問題
- 1. は、携帯電話のカレンダーやリマインダ
- 2. リマインダを電話で実際のカレンダーに入れますか?
- 3. "form_for"にカレンダーを追加する方法
- 4. カレンダーに日を追加する
- 5. 「カレンダーに追加」リンクを提供する
- 6. PHPカレンダーにイベントを追加する
- 7. Googleカレンダーにイベントを追加する
- 8. カレンダーにイベントを追加する
- 9. カレンダーにasp.netコントロールを追加します。
- 10. Android新しいカレンダーを追加する
- 11. iphoneアプリからGoogleカレンダーに予定を追加するには?
- 12. アクティビティからGoogleカレンダーに予定を追加するには?
- 13. html5モバイルウェブページからAndroidカレンダーにエントリーを追加するには?
- 14. Android 4.0でカレンダーと予定を追加
- 15. カレンダーを開かずにカレンダーに複数の予定を追加する..?
- 16. ACCOUNT_TYPE_LOCALのカレンダーをAndroid 4に追加するとカレンダーがクラッシュする
- 17. カレンダーの追加とクエリ
- 18. iPhoneカレンダーでイベントを追加する方法は?
- 19. Googleカレンダーに.icsカレンダーの予定を追加するにはどうすればよいですか?
- 20. ユーザのプロンプトなしでカレンダーに追加する方法UWP C#
- 21. カレンダーにイベントを非常に遅く追加する
- 22. なぜdatepickerは私のビューにカレンダーを追加しますか?
- 23. GoogleのカレンダーにPHPを使用してイベントを追加する
- 24. カレンダーにカスタム表示モードを追加する方法
- 25. PHP GoogleカレンダーAPI:一度に複数のイベントを追加する
- 26. jqueryカレンダーに過去の年を追加する方法
- 27. アンドロイドスタジオのGoogleカレンダーにイベントを追加する
- 28. 特定のカレンダーにカレンダーイベントを追加する
- 29. モバイルプラットフォームのブラウザ内から予定をカレンダーに追加する
- 30. Googleカレンダーに予定を追加するときの時差
jayesh、ContentProviderにアラームを挿入するには 'content:// calendar/reminders' URIを使用しますか? –
これはあなたの問題を解決しましたか? –