簡體   English   中英

Android Calender提醒事件問題

[英]Android Calender reminder event issue

大家好,我是這里的新手,但我不在乎您是否喜歡.........但我不理解此站點的工作方式............. ....

如果我問了任何已經問過的問題,我會得到負面的意見.....並且幸運的是,如果我發現有用的東西..那么問題是...我無法在該帖子中添加評論以為我澄清答案...例如,我發現以下鏈接對我有用

在手機的真實日歷中放置提醒?

在該代碼中,用戶使用了以下行

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

我不明白該怎么辦,因為Uri.parse()接受字符串參數,但是在這里他使用活動作為參數

getCalendarUriBase(活動行為)

如果允許將評論添加到該帖子中,我不會問這個問題

希望您能理解我的觀點....有關完整代碼,請訪問上面的鏈接

奇怪的是您不理解該答案。

getCalendarUriBase返回一個String,其實現在該答案中。

我在這里復制粘貼給你

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;

恕我直言,

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

字符串串聯?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM