简体   繁体   English

Android Calender提醒事件问题

[英]Android Calender reminder event issue

hello everyone I am a newbie here but I dont care if you people like it or not......... but I do not understand the way this site work................. 大家好,我是这里的新手,但我不在乎您是否喜欢.........但我不理解此站点的工作方式............. ....

If I ask any question that has already been asked i get negative points..... and luckily if I find something useful.. the problem is then... I can not add my comments to that post to clarify the answer for me... for instance i found the following link useful for me 如果我问了任何已经问过的问题,我会得到负面的意见.....并且幸运的是,如果我发现有用的东西..那么问题是...我无法在该帖子中添加评论以为我澄清答案...例如,我发现以下链接对我有用

Put reminder in real calendar on the phone? 在手机的真实日历中放置提醒?

In that code the user have used the following line 在该代码中,用户使用了以下行

Uri EVENTS_URI = Uri.parse(getCalendarUriBase(this) + "events");

I don't understand what should I do because Uri.parse() takes a string argument but here he uses an activity as a argument in 我不明白该怎么办,因为Uri.parse()接受字符串参数,但是在这里他使用活动作为参数

getCalendarUriBase(Activity act) getCalendarUriBase(活动行为)

I would not have asked this question if I would've allowed to add my comments into that post 如果允许将评论添加到该帖子中,我不会问这个问题

I hope you can understand the my point.... and for full code please visit the above link 希望您能理解我的观点....有关完整代码,请访问上面的链接

It is strange that you didn't understand that answer. 奇怪的是您不理解该答案。

getCalendarUriBase returns a String, its implementation is in that answer. getCalendarUriBase返回一个String,其实现在该答案中。

I copypaste it here for you 我在这里复制粘贴给你

private String getCalendarUriBase(Activity act) {

                String calendarUriBase = null;
                Uri calendars = Uri.parse("content://calendar/calendars");
                Cursor managedCursor = null;
                try {
                    managedCursor = act.managedQuery(calendars, null, null, null, null);
                } catch (Exception e) {
                }
                if (managedCursor != null) {
                    calendarUriBase = "content://calendar/";
                } else {
                    calendars = Uri.parse("content://com.android.calendar/calendars");
                    try {
                        managedCursor = act.managedQuery(calendars, null, null, null, null);
                    } catch (Exception e) {
                    }
                    if (managedCursor != null) {
                        calendarUriBase = "content://com.android.calendar/";
                    }
                }
                return calendarUriBase;

imho, 恕我直言,

getCalendarUriBase(this) + "events"
=
getCalendarUriBase(this).toString() + "events"

String concatenation? 字符串串联?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM