【问题标题】:How to filter calendar events by attendee email如何通过与会者电子邮件过滤日历事件
【发布时间】:2013-03-05 09:46:50
【问题描述】:

我的目标是从我的日历中删除所有日历事件,并由我正在寻找的与会者过滤。换句话说,我想要 Mayer 先生参加的所有活动 我已经解决了这个问题来获取我的事件。我的光标中有它们 curCalendar 但是如何通过与会者电子邮件过滤 curCalendar? 我正在考虑创建一个包含所有事件 ID 的数组,或者我是否可以删除光标 curCalendar 的行。嗯,我需要帮助。如何按特殊参与者过滤我的 curCalendar 电子邮件...

if(!strEmailFilter.isEmpty()){

            //there is an Email Filter - look for a special Attendee within all Events...
            curCalendar.moveToFirst();
            index = curCalendar.getColumnIndex(CalendarContract.Events._ID);
            strEventId = curCalendar.getString(index);
            strEmail = openCalendar.getEmailfromAttendee(this, strEventId);
            Integer i= 0;
            if (strEmail.equals(strEmailFilter)){
                //Attendee email is equal to filter email
                //Add row to CurCalendarGefiltert
                strEventsGefiltert [i] = strEventId;

            }
            while (curCalendar.moveToNext()) {
                i = i +1;
                index = curCalendar.getColumnIndex(CalendarContract.Events._ID);
                strEventId = curCalendar.getString(index);
                strEmail = openCalendar.getEmailfromAttendee(this, strEventId);
                if (strEmail.equals(strEmailFilter)){
                    strEventsGefiltert [i] = strEventId;
                //  curCalendarGefiltert.

                }
            }

        }

                 MyCalendarAdapter myCalendaradapter = new MyCalendarAdapter (
                          this,
                          R.layout.terminzeile_google,
                          curCalendar,
                          new String[] {CalendarContract.Events.TITLE, CalendarContract.Events.DESCRIPTION},
                          new int[] {R.id.textViewTitle, R.id.textViewProjekt}

                          );





        /*
        myClientsadapter.setViewBinder(new MyDataAdapter.ViewBinder() {
            public boolean setViewValue(View view, Cursor cursor, int columnIndex) {


                if(columnIndex == 13) {
                        String strBeginn = cursor.getString(columnIndex);
                        CheckBox cb = (CheckBox) view;
                        int intbezahlt = cursor.getInt(13);
                        cb.setChecked(intbezahlt > 0);
                        return true;
                }

                String str = cursor.getString(columnIndex);
                return false;
            }
        });


        */
        listViewTermine.setAdapter(myCalendaradapter);

【问题讨论】:

    标签: android filter android-calendar


    【解决方案1】:

    根据找到的每个事件的 eventId,使用内容 URI“CalendarContract.Attendees.CONTENT_URI”搜索参加者表。只需在找到匹配项时捕获事件的值。

    因此,简而言之,您需要编写一个与您编写的方法类似的方法来通过 CalendarContract 读取事件。

    查看此链接以获取有关如何访问与会者表的更多详细信息: https://android-dot-google-developers.appspot.com/reference/android/provider/CalendarContract.Attendees.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多