How to go to the default calendar in Android?
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 to share
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 to share