コード例 #1
0
        @SuppressLint("NewApi")
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long i) {
          AlertActivity alertActivity = AlertActivity.this;
          Cursor cursor = alertActivity.getItemForView(view);

          long alarmId = cursor.getLong(INDEX_ROW_ID);
          long eventId = cursor.getLong(AlertActivity.INDEX_EVENT_ID);
          long startMillis = cursor.getLong(AlertActivity.INDEX_BEGIN);

          // Mark this alarm as DISMISSED
          dismissAlarm(alarmId, eventId, startMillis);

          // build an intent and task stack to start EventInfoActivity with AllInOneActivity
          // as the parent activity rooted to home.
          long endMillis = cursor.getLong(AlertActivity.INDEX_END);
          Intent eventIntent =
              AlertUtils.buildEventViewIntent(AlertActivity.this, eventId, startMillis, endMillis);

          if (Utils.isJellybeanOrLater()) {
            TaskStackBuilder.create(AlertActivity.this)
                .addParentStack(EventInfoActivity.class)
                .addNextIntent(eventIntent)
                .startActivities();
          } else {
            alertActivity.startActivity(eventIntent);
          }

          alertActivity.finish();
        }