开发者

error in using calendar in android?

开发者 https://www.devze.com 2023-03-17 03:07 出处:网络
I am trying to open calendar from my app and using the code below as i found it in this question :how can i open the calendar from my app? ...but getting following error

I am trying to open calendar from my app and using the code below as i found it in this question :how can i open the calendar from my app? ...but getting following error

07-01 14:19:26.299: ERROR/AndroidRuntime(14167): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.google.android.calendar/com.android.calendar.LaunchActivity}; have you declared this activity in your AndroidManifest.xml?

any help will be u开发者_开发问答seful..

Intent i = new Intent();
    ComponentName cn = new ComponentName("com.google.android.calendar", "com.android.calendar.LaunchActivity"); 
    i.setComponent(cn); 
    startActivity(i);


Have you tried specifying permissions ?

http://developer.android.com/reference/android/Manifest.permission.html#READ_CALENDAR

or alternatively use:

    Intent intent = new Intent(Intent.ACTION_EDIT);  
    intent.setType("vnd.android.cursor.item/event");
    intent.putExtra("title", "Some title");
    intent.putExtra("description", "Some description");
    intent.putExtra("beginTime", new java.util.Date().getTime());
    intent.putExtra("endTime", new java.util.Date().getTime()+36000000);
    startActivity(intent);
0

精彩评论

暂无评论...
验证码 换一张
取 消