Wednesday, May 22, 2013

How to open calendar intent programmatically

I was looking around for a way to open the calendar application for viewing. The closest solution I found was running the stock calendar app explicitally using the package name.

Here's the best solution I came up with to open for viewing the Android calendar:
Intent i = new Intent(Intent.ACTION_VIEW);
// Android 2.2+
i.setData(Uri.parse("content://com.android.calendar/time"));  
// Before Android 2.2+
//i.setData(Uri.parse("content://calendar/time"));  

startActivity(i);

Wednesday, May 15, 2013

Error after updating Android's ADT 22 plug-in on Eclipse

After updating to the latest ADT version on Eclipse Juno, Windows 7, I got the following error:
 
Error Loading the SDK:

Error: Error parsing the sdk.
Failed to create C:\Program Files (x86)\Android\android-sdk\build-tools

Solution: To my best of understanding the ADT plugin is trying to change files in location the current user can't. I'm sure there are better solutions, but this is the quickest:
1. Go to folder 'C:\Program Files (x86)\Android\'
2. Right click on 'android-sdk' => 'Properties' => 'Security'
3. Click on 'Users' and then 'Edit', and add 'Full Control' and hit 'OK'

After Windows finish changing the permissions, restart Eclipse.