How to read and edit Android calendar events using the new Android 4.0 Ice Cream Sandwich API?

前端 未结 6 2169
醉梦人生
醉梦人生 2020-11-28 22:13

We are trying to show user the Ice cream Sandwich calendar view, when they want to add a new event. We can only test this in emulator.

The other problem is that we c

6条回答
  •  天涯浪人
    2020-11-28 22:49

    I have creted following Method to handle the flexibility of TIMEZONE

    // Converting TimeZone in to GMT to save upon local Db to avoid // Controversy Over Server

    private String convertDateTimeZone(long originalDate) {
            String newDate = "";
            Date date = new Date(originalDate);
            DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
            Date parsed = null;
            try {
                parsed = formatter.parse(formatter.format(date).toString());
                TimeZone tz = TimeZone.getTimeZone("GMT");
                SimpleDateFormat destFormat = new SimpleDateFormat(
                        "yyyy-MM-dd HH:mm:ss");
                destFormat.setTimeZone(tz);
    
                newDate = destFormat.format(parsed);
            } catch (Exception e) {
            }
            return newDate;
        }
    

提交回复
热议问题