如何从android中的隐式意图中获取值?

时间:2012-10-04 05:16:19

标签: android android-intent android-calendar

我正在我的应用程序中显示日历事件活动(Android系统活动)。我用“显示事件详细信息”按钮生成它。当我点击按钮时,它将显示Android系统提供的日历活动。当我从事件活动中修改一个值时,它会反映在Android设备的事件表中,但是当我通过我的应用程序修改事件时,如何从中获取修改后的值?

    Intent l_intent = new Intent(Intent.ACTION_EDIT);
    l_intent.setType("vnd.android.cursor.item/event");
    //l_intent.putExtra("calendar_id", m_selectedCalendarId);  //this doesn't work
    l_intent.putExtra("title", "roman10 calendar tutorial test");
    l_intent.putExtra("description", "This is a simple test for calendar api");
    l_intent.putExtra("eventLocation", "@home");
    l_intent.putExtra("beginTime", System.currentTimeMillis());
    l_intent.putExtra("endTime", System.currentTimeMillis() + 1800*1000);
    l_intent.putExtra("allDay", 0);
    //status: 0~ tentative; 1~ confirmed; 2~ canceled
    l_intent.putExtra("eventStatus", 1);
    //0~ default; 1~ confidential; 2~ private; 3~ public
    l_intent.putExtra("visibility", 0);
    //0~ opaque, no timing conflict is allowed; 1~ transparency, allow overlap of scheduling
    l_intent.putExtra("transparency", 0);
    //0~ false; 1~ true
    l_intent.putExtra("hasAlarm", 1);
    try {
        startActivity(l_intent);
    } catch (Exception e) {
        Toast.makeText(this.getApplicationContext(), "Sorry, no compatible calendar is found!", Toast.LENGTH_LONG).show();
    }

0 个答案:

没有答案