I am trying to add my own calendar in android using the following code.
I have provided read write permission also in manifest.
and my error is : “Error while creating calendar the name must not be empty: null” though i have provided the name…
any one please hep me to solve it and also provide link to working solution of creating 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);
You should try something like this :