I am trying to add my own calendar in android using the following code. I also granted permission to read the entry in the manifest.
and my mistake is: "Error creating calendar, name should not be empty: null" , although I specified the name ...
any, please help me solve it, as well as provide a link to a working solution for creating a calendar in android.
final Uri calUri = Uri.parse("content://com.android.calendar/calendars"); android.accounts.Account account; ContentValues vals = new ContentValues(); vals.put("_id", 1); vals.put("_sync_account_type", "ACCOUNT_TYPE_LOCAL"); vals.put("name","sachin" ); vals.put("displayName","my_Cal"); vals.put("color", 14417920); vals.put("access_level", 700); vals.put("selected", 1); vals.put("sync_events", 1); vals.put("timezone", "GMT"); vals.put("hidden", 0); Uri result= getContentResolver().insert(calUri, vals); System.out.println(result);
source share