Bhaskar Reddy
Bhaskar Reddy

Reputation: 480

How to insert eventTimeZone in android calendar?

I am trying to save event along with "eventTimezine" option but I am not getting any Idea which type of string is suitable for "eventTimezine".

Ex:

` ContentValues event = new ContentValues();
  event.put("eventTimezone", "?");`

Please help me.

Upvotes: 0

Views: 1044

Answers (1)

sinisha
sinisha

Reputation: 1013

I tried this

event.put("eventTimezone", "Europe/London");

and it worked. You could make one input into your calendar and make a small test program to see what timeZone it use. You could you something like this:

String[] projection = new String[] { "_id", "name" };
            Uri calendars = Uri.parse("content://com.android.calendar/calendars");

            String calName; 
            String calId=""; 
            Cursor managedCursor = managedQuery(calendars, projection,null, null, null);
            if (managedCursor.moveToFirst()) {

                int nameColumn = managedCursor.getColumnIndex("name"); 
                int idColumn = managedCursor.getColumnIndex("_id");
                do {
                    calName = managedCursor.getString(nameColumn);
                    calId = managedCursor.getString(idColumn);
                } while (managedCursor.moveToNext());
            }
                  if (managedCursor != null && managedCursor.moveToFirst()) {
                      int tzone = managedCursor.getColumnIndex("eventTimezone");
                      String timezone = managedCursor.getString(tzone);
                  }

Upvotes: 1

Related Questions