當前位置: 首頁>>代碼示例>>Java>>正文


Java Intent.ACTION_INSERT屬性代碼示例

本文整理匯總了Java中android.content.Intent.ACTION_INSERT屬性的典型用法代碼示例。如果您正苦於以下問題:Java Intent.ACTION_INSERT屬性的具體用法?Java Intent.ACTION_INSERT怎麽用?Java Intent.ACTION_INSERT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.content.Intent的用法示例。


在下文中一共展示了Intent.ACTION_INSERT屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: prepareAddContactIntent

public static Intent prepareAddContactIntent(String displayName, String sipUri) {
	Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
	intent.putExtra(Insert.NAME, displayName);
	
	if (sipUri != null && sipUri.startsWith("sip:")) {
		sipUri = sipUri.substring(4);
	}
	
	ArrayList<ContentValues> data = new ArrayList<ContentValues>();
	ContentValues sipAddressRow = new ContentValues();
	sipAddressRow.put(Contacts.Data.MIMETYPE, SipAddress.CONTENT_ITEM_TYPE);
	sipAddressRow.put(SipAddress.SIP_ADDRESS, sipUri);
	data.add(sipAddressRow);
	intent.putParcelableArrayListExtra(Insert.DATA, data);
	
	return intent;
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:17,代碼來源:ApiElevenPlus.java

示例2: addEventOnCalendar

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void addEventOnCalendar(PersianDate persianDate) {
    Intent intent = new Intent(Intent.ACTION_INSERT);
    intent.setData(CalendarContract.Events.CONTENT_URI);

    CivilDate civil = DateConverter.persianToCivil(persianDate);

    intent.putExtra(CalendarContract.Events.DESCRIPTION,
            mPersianCalendarHandler.dayTitleSummary(persianDate));

    Calendar time = Calendar.getInstance();
    time.set(civil.getYear(), civil.getMonth() - 1, civil.getDayOfMonth());

    intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,
            time.getTimeInMillis());
    intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME,
            time.getTimeInMillis());
    intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true);

    startActivity(intent);
}
 
開發者ID:Roojin,項目名稱:persian-calendar-view,代碼行數:21,代碼來源:CalendarFragment.java

示例3: openAddContact

public Intent openAddContact (String name, String phone) {
	Intent intent = new Intent(Intent.ACTION_INSERT);
	intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
	
	intent.putExtra(ContactsContract.Intents.Insert.NAME, name);
	intent.putExtra(ContactsContract.Intents.Insert.PHONE, phone);
	
	return intent;
}
 
開發者ID:jrvansuita,項目名稱:MaterialAbout,代碼行數:9,代碼來源:IntentUtil.java

示例4: addCalendarEvent

/**
 * Sends an intent to create a new calendar event by prepopulating the Add Event UI. Older
 * versions of the system have a bug where the event title will not be filled out.
 *
 * @param summary A description of the event
 * @param start   The start time
 * @param allDay  if true, event is considered to be all day starting from start time
 * @param end     The end time (optional)
 * @param location a text description of the event location
 * @param description a text description of the event itself
 * @param attendees attendees to invite
 */
private void addCalendarEvent(String summary,
                              Date start,
                              boolean allDay,
                              Date end,
                              String location,
                              String description,
                              String[] attendees) {
  Intent intent = new Intent(Intent.ACTION_INSERT);
  intent.setType("vnd.android.cursor.item/event");
  long startMilliseconds = start.getTime();
  intent.putExtra("beginTime", startMilliseconds);
  if (allDay) {
    intent.putExtra("allDay", true);
  }
  long endMilliseconds;
  if (end == null) {
    if (allDay) {
      // + 1 day
      endMilliseconds = startMilliseconds + 24 * 60 * 60 * 1000;
    } else {
      endMilliseconds = startMilliseconds;
    }
  } else {
    endMilliseconds = end.getTime();
  }
  intent.putExtra("endTime", endMilliseconds);
  intent.putExtra("title", summary);
  intent.putExtra("eventLocation", location);
  intent.putExtra("description", description);
  if (attendees != null) {
    intent.putExtra(Intent.EXTRA_EMAIL, attendees);
    // Documentation says this is either a String[] or comma-separated String, which is right?
  }

  try {
    // Do this manually at first
    rawLaunchIntent(intent);
  } catch (ActivityNotFoundException anfe) {
    Log.w(TAG, "No calendar app available that responds to " + Intent.ACTION_INSERT);
    // For calendar apps that don't like "INSERT":
    intent.setAction(Intent.ACTION_EDIT);
    launchIntent(intent); // Fail here for real if nothing can handle it
  }
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:56,代碼來源:CalendarResultHandler.java

示例5: addCalendarEvent

/**
 * Sends an intent to create a new calendar event by prepopulating the Add Event UI. Older
 * versions of the system have a bug where the event title will not be filled out.
 *
 * @param summary     A description of the event
 * @param start       The start time
 * @param allDay      if true, event is considered to be all day starting from start time
 * @param end         The end time (optional; can be < 0 if not specified)
 * @param location    a text description of the event location
 * @param description a text description of the event itself
 * @param attendees   attendees to invite
 */
private void addCalendarEvent(String summary,
                              long start,
                              boolean allDay,
                              long end,
                              String location,
                              String description,
                              String[] attendees) {
    Intent intent = new Intent(Intent.ACTION_INSERT);
    intent.setType("vnd.android.cursor.item/event");
    intent.putExtra("beginTime", start);
    if (allDay) {
        intent.putExtra("allDay", true);
    }
    if (end < 0L) {
        if (allDay) {
            // + 1 day
            end = start + 24 * 60 * 60 * 1000;
        } else {
            end = start;
        }
    }
    intent.putExtra("endTime", end);
    intent.putExtra("title", summary);
    intent.putExtra("eventLocation", location);
    intent.putExtra("description", description);
    if (attendees != null) {
        intent.putExtra(Intent.EXTRA_EMAIL, attendees);
        // Documentation says this is either a String[] or comma-separated String, which is right?
    }

    try {
        // Do this manually at first
        rawLaunchIntent(intent);
    } catch (ActivityNotFoundException anfe) {
        Log.w(TAG, "No calendar app available that responds to " + Intent.ACTION_INSERT);
        // For calendar apps that don't like "INSERT":
        intent.setAction(Intent.ACTION_EDIT);
        launchIntent(intent); // Fail here for real if nothing can handle it
    }
}
 
開發者ID:xiong-it,項目名稱:ZXingAndroidExt,代碼行數:52,代碼來源:CalendarResultHandler.java


注:本文中的android.content.Intent.ACTION_INSERT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。