如何使用 Android Studio 中的意图读取一周的日历事件?

     2023-04-18     131

关键词:

【中文标题】如何使用 Android Studio 中的意图读取一周的日历事件?【英文标题】:How to read calendar event for the week using intents in Android Studio? 【发布时间】:2021-07-10 01:13:09 【问题描述】:

嘿,我正在制作一个语音助手应用程序,并且想让用户知道即将发生的事件,所以我想使用意图读取事件。我一直在尝试阅读谷歌日历 API 并弄清楚,但我不太明白。我将非常感谢任何可以帮助我的人...

我已经实现了一种使用以下方法创建新事件的方法:

Intent intent = new Intent(Intent.ACTION_INSERT);
intent.setData(CalendarContract.Events.CONTENT_URI);
intent.putExtra(CalendarContract.Events.TITLE, titleString);
intent.putExtra(CalendarContract.Events.DESCRIPTION, description);
intent.putExtra(CalendarContract.Events.EVENT_LOCATION, "Worldwide");
intent.putExtra(CalendarContract.Events.ALL_DAY, true);
intent.putExtra(Intent.EXTRA_EMAIL, "test@gmail.com");
intent.putExtra(CalendarContract.Events.EVENT_TIMEZONE, timeZone.getID());
intent.putExtra(CalendarContract.Events.HAS_ALARM, 1);

【问题讨论】:

【参考方案1】:

试着这样做

Cursor cursor = context.getContentResolver().query(
                        Uri.parse("content://com.android.calendar/events"),
                        new String[]  "calendar_id", "title", "description","dtstart", 
                        "dtend", "eventLocation" , null, null, null);
cursor.moveToFirst();

【讨论】:

嘿,谢谢你的回复,我现在做了类似的事情,我真的很感激。

通过 android studio 中的意图发送 MultiMap 类型的数据结构

】通过androidstudio中的意图发送MultiMap类型的数据结构【英文标题】:SendingaMultiMaptypedatastructurethroughanintentinandroidstudio【发布时间】:2018-12-0622:47:58【问题描述】:我必须为我的android应用程序创建一个“multimap”类型的数据结构,... 查看详情

如何使用默认裁剪意图裁剪 android marshmallow 中的图像?

】如何使用默认裁剪意图裁剪androidmarshmallow中的图像?【英文标题】:HowtoCroptheimageinandroidmarshmallowbyusingdefaultcropintent?【发布时间】:2016-10-1813:29:26【问题描述】:在我的应用程序要求中,从图库中选择图像,然后裁剪所选图像... 查看详情

仅通过 Android Studio 中的意图打开电子邮件应用程序

】仅通过AndroidStudio中的意图打开电子邮件应用程序【英文标题】:OpenEmailApponlythroughintentinAndroidStudio【发布时间】:2020-08-0223:20:58【问题描述】:我不想将emails发送给其他用户。我只想打开Email的launchingactivity。我已经通过不同... 查看详情

如何使用您的 Android 应用程序中的意图以专业模式打开默认相机应用程序?

】如何使用您的Android应用程序中的意图以专业模式打开默认相机应用程序?【英文标题】:Howtoopenthedefaultcameraappinprofessionalmodeusinganintentinyourandroidapp?【发布时间】:2021-09-1812:34:29【问题描述】:设备中的相机应用程序提供专业... 查看详情

更改意图时 Android Studio 崩溃

】更改意图时AndroidStudio崩溃【英文标题】:Androidstudiocrashedwhenchangingintent【发布时间】:2015-04-2909:28:47【问题描述】:程序应该像这样工作,显示一个计时器和一张图片,使用名为“10-11岁”的底部应该将用户切换到另一个具有... 查看详情

Android 10 中的相机意图权限

】Android10中的相机意图权限【英文标题】:CameraintentpermissionsinAndroid10【发布时间】:2020-09-2910:53:53【问题描述】:在处理在Android10中使用具有隐式意图的相机应用时遇到一个不寻常的问题。我正在使用BigNerdRanchAndroid编程教科书... 查看详情

如何解决android原生应用程序中的意图重定向?

】如何解决android原生应用程序中的意图重定向?【英文标题】:howtosolveintentredirectioninandroidnativeapp?【发布时间】:2021-06-1400:53:19【问题描述】:我在我的应用程序中使用深层链接时遇到问题。当我尝试在Googleplay中上传更新时。... 查看详情

如何使用单击事件和意图将当前日期从一个活动传递到android中的下一个活动(代码片段)

如何使用点击事件和意图将当前日期从一个活动传递到下一个活动(将当前日期传递给soap服务)答案Fromthecurrentactivity:Intentintent=newIntent(this,NextActivity.class);intent.putExtra("date",dateObj.getTime());startActivity(intent);Fromnextactivity:D 查看详情

如何在android中使用意图过滤器获取数据

】如何在android中使用意图过滤器获取数据【英文标题】:howtogetdatabyusingintentfilterinandroid【发布时间】:2019-01-0919:20:45【问题描述】:我正在尝试生成特定活动的url,因为我想通过我的应用程序共享这个特定的url,当我们单击该u... 查看详情

如何使用android studio中的改造服务在请求中传递json

】如何使用androidstudio中的改造服务在请求中传递json【英文标题】:Howtopassjsoninrequestusingretrofitservicesinandroidstudio【发布时间】:2018-11-0418:08:23【问题描述】:如何在改造中传递这些类型的请求中的请求数据。【问题讨论】:您必... 查看详情

Android如何根据选择器意图中的用户操作请求权限

】Android如何根据选择器意图中的用户操作请求权限【英文标题】:Androidhowtorequestpermissionbasedonuseractioninchooserintent【发布时间】:2017-07-2223:18:53【问题描述】:我无法根据用户在选择器意图中选择的内容请求用户许可。目前,我... 查看详情

Android Studio,如何使用数组或光标中的数据填充自定义 ListView?

】AndroidStudio,如何使用数组或光标中的数据填充自定义ListView?【英文标题】:AndroidStudio,HowcanIfillacustomListViewwithdatafromanarrayorcursor?【发布时间】:2015-12-2414:07:42【问题描述】:所以我有一个看起来像这样的片段视图:<LinearLay... 查看详情

如何在 android studio 中使用我的 android 项目作为其他项目中的库? [复制]

】如何在androidstudio中使用我的android项目作为其他项目中的库?[复制]【英文标题】:howtousemyandroidprojectinandroidstudioasalibraryinotherprojects?[duplicate]【发布时间】:2016-06-1719:09:27【问题描述】:我在androidstudio中开发了一个android应用... 查看详情

使用android studio运行应用程序时如何启用android 6.0中的所有权限

】使用androidstudio运行应用程序时如何启用android6.0中的所有权限【英文标题】:Howtoenableallthepermissionsinandroid6.0whenruntheappusingandroidstudio【发布时间】:2017-01-0108:37:34【问题描述】:我正在使用android6.0在androidstudio中构建我的应用程... 查看详情

如何在 Android Studio 中使用 Kotlin 处理 WebChromeClient 中的输入类型文件?

】如何在AndroidStudio中使用Kotlin处理WebChromeClient中的输入类型文件?【英文标题】:HowtohandleinputtypefileinWebChromeClientusingKotlininAndroidStudio?【发布时间】:2020-10-0412:17:02【问题描述】:任何人都可以帮助我实现WebChromeClient以使用Kotlin... 查看详情

Android:如何使用 shell 命令或意图运行谷歌音乐的“Shuffle all”?

】Android:如何使用shell命令或意图运行谷歌音乐的“Shuffleall”?【英文标题】:Android:Howtorungooglemusic\'s"Shuffleall"withshellcommandsorintents?【发布时间】:2013-01-0111:30:27【问题描述】:如果可能的话,我想以任何方式按下播放... 查看详情

如何了解 Android Studio Bundle 中的“关键”是啥?

】如何了解AndroidStudioBundle中的“关键”是啥?【英文标题】:Howtolearnwhatisthe"key"inAndroidStudioBundle?如何了解AndroidStudioBundle中的“关键”是什么?【发布时间】:2019-06-1022:19:26【问题描述】:我使用的库不是最新的。(https:/... 查看详情

如何在 Android 相机上使用意图添加功能裁剪图像?

】如何在Android相机上使用意图添加功能裁剪图像?【英文标题】:Howtoaddfeaturecropimageusingintentonandroidcamera?【发布时间】:2015-09-3001:57:03【问题描述】:我尝试使用android相机上的意图使应用程序android用于裁剪图像,然后保存结果... 查看详情