How to go to the default calendar in Android?

I am creating a calendar based application and I am trying to navigate my application to the default calendar and also search the web, but I cannot, so it is possible to open the default calendar using the thanks in advance intent.

+3


source to share


2 answers


try it



PackageManager packmngr = this.getPackageManager(); 
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER); 
List<ResolveInfo> list = packmngr.queryIntentActivities(intent, PackageManager.PERMISSION_GRANTED);
ResolveInfo Resolvebest = null;
for (final ResolveInfo info : list){
if (info.activityInfo.packageName.endsWith(".calendar"))
        Resolvebest = info;
}
if (Resolvebest != null){
 intent.setClassName(Resolvebest.activityInfo.packageName,
 Resolvebest.activityInfo.name);
 startActivity(intent);
}

      

+3


source


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", eventStartInMillis);
intent.putExtra("endTime", eventEndInMillis);
startActivity(intent);

      



Documentation found here

+1


source







All Articles