Android – Working With Calendar and Managing Compatibility With Froyo

By -

Today i came across an article, in that article i found a great thing that the Calendar URI in FROYO 2.2 version is changed from content://calendar/calendars to content://

To manage the compatibility with such Calendar Code across all the version, we need to handle Old URI along with the New URI, we can handle it in following way:

Uri CalendarUri, EventsUri;
if (android.os.Build.VERSION.SDK_INT <= 7 )
 CalendarUri = Uri.parse("content://calendar/calendars");
 EventsUri = Uri.parse("content://calendar/events");
CalendarUri = Uri.parse("content://");
EventsUri = Uri.parse("content://");

In above code, android.os.Build.VERSION.SDK_INT will return the SDK version number that you are testing with.

Article’s Actual link:

Paresh Mayani

Lazy android developer, exploring the horizon of android development since 7 years, currently working as a Technical Lead - Android at Simform Solutions, India. Former Application Architect at KarConnect. He is the Head/Organizer of Google Developers Group (GDG), Ahmedabad

Loading Facebook Comments ...
Loading Disqus Comments ...