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


Java Intent.ACTION_EDIT屬性代碼示例

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


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

示例1: onCreate

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    switch (getIntent().getAction()) {
        case "com.android.camera.action.REVIEW":
        case Intent.ACTION_VIEW:
            view(getIntent());
            this.finish();
            break;
        case Intent.ACTION_PICK:
            pick(getIntent());
            break;
        case Intent.ACTION_GET_CONTENT:
            pick(getIntent());
            break;
        case Intent.ACTION_EDIT:
            edit(getIntent());
            break;
        default:
            break;
    }
}
 
開發者ID:kollerlukas,項目名稱:Camera-Roll-Android-App,代碼行數:23,代碼來源:IntentReceiver.java

示例2: prepareEditContactIntentWithSipAddress

public static Intent prepareEditContactIntentWithSipAddress(int id, String sipUri) {
	Intent intent = new Intent(Intent.ACTION_EDIT, Contacts.CONTENT_URI);
	Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, id);
	intent.setData(contactUri);
	
	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,代碼行數:14,代碼來源:ApiElevenPlus.java

示例3: addEventToCalendar

private void addEventToCalendar(int year, int month, int day, int hour, String appointmentWithDoctor) {
    Calendar cal = Calendar.getInstance();
    cal.set(year, month, day, hour, 0);
    Intent intent = new Intent(Intent.ACTION_EDIT);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setType("vnd.android.cursor.item/event");
    intent.putExtra("beginTime", cal.getTimeInMillis());
    intent.putExtra("endTime", cal.getTimeInMillis() + 3600000);
    intent.putExtra("title", appointmentWithDoctor);
    startActivity(intent);
}
 
開發者ID:Nihal369,項目名稱:Amaro,代碼行數:11,代碼來源:DoctorPage.java

示例4: addEventToCalendar

private void addEventToCalendar(ColegiElectoral colegiElectoral) {
    Calendar calendar = Calendar.getInstance(Locale.getDefault());
    calendar.set(2017, Calendar.OCTOBER, 1, 9, 0);

    Intent intent = new Intent(Intent.ACTION_EDIT);
    intent.setType("vnd.android.cursor.item/event");
    intent.putExtra(CalendarContract.Events.TITLE, StringsManager.getString("notification_title"));
    intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, calendar.getTimeInMillis());
    intent.putExtra(CalendarContract.Events.ALL_DAY, true);
    String location = colegiElectoral.getLocal() + ": " + colegiElectoral.getAdresa() + ", " + colegiElectoral.getMunicipi();
    intent.putExtra(CalendarContract.Events.EVENT_LOCATION, location);

    startActivity(intent);
}
 
開發者ID:mosquitolabs,項目名稱:referendum_1o_android,代碼行數:14,代碼來源:VoteFragment.java

示例5: editItem

public static void editItem(Context ctx, Uri uri, boolean image) {
    LogPrinter.i("wyt","editItem : " + uri);
    Intent intent = new Intent(Intent.ACTION_EDIT);
    intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
    intent.setDataAndType(uri, image ? "image/jpeg" : "video/*");
    ctx.startActivity(Intent.createChooser(intent, ctx.getString(R.string.edit)));
}
 
開發者ID:YuntaoWei,項目名稱:PictureShow,代碼行數:7,代碼來源:PicShowUtils.java

示例6: editStyles

public void editStyles()
{
    File file = new File(getHome(), CSS_STYLES);
    Uri uri = Uri.fromFile(file);

    Intent intent = new Intent(Intent.ACTION_EDIT);
    intent.setDataAndType(uri, "text/css");
    startActivity(intent);
}
 
開發者ID:billthefarmer,項目名稱:diary,代碼行數:9,代碼來源:Diary.java

示例7: onPrepareOptionsMenu

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);

    // The paste menu item is enabled if there is data on the clipboard.
    ClipboardManager clipboard = (ClipboardManager)
            getSystemService(Context.CLIPBOARD_SERVICE);


    MenuItem mPasteItem = menu.findItem(R.id.menu_paste);

    // If the clipboard contains an item, enables the Paste option on the menu.
    if (clipboard.hasPrimaryClip()) {
        mPasteItem.setEnabled(true);
    } else {
        // If the clipboard is empty, disables the menu's Paste option.
        mPasteItem.setEnabled(false);
    }

    // Gets the number of notes currently being displayed.
    final boolean haveItems = getListAdapter().getCount() > 0;

    // If there are any notes in the list (which implies that one of
    // them is selected), then we need to generate the actions that
    // can be performed on the current selection.  This will be a combination
    // of our own specific actions along with any extensions that can be
    // found.
    if (haveItems) {

        // This is the selected item.
        Uri uri = ContentUris.withAppendedId(getIntent().getData(), getSelectedItemId());

        // Creates an array of Intents with one element. This will be used to send an Intent
        // based on the selected menu item.
        Intent[] specifics = new Intent[1];

        // Sets the Intent in the array to be an EDIT action on the URI of the selected note.
        specifics[0] = new Intent(Intent.ACTION_EDIT, uri);

        // Creates an array of menu items with one element. This will contain the EDIT option.
        MenuItem[] items = new MenuItem[1];

        // Creates an Intent with no specific action, using the URI of the selected note.
        Intent intent = new Intent(null, uri);

        /* Adds the category ALTERNATIVE to the Intent, with the note ID URI as its
         * data. This prepares the Intent as a place to group alternative options in the
         * menu.
         */
        intent.addCategory(Intent.CATEGORY_ALTERNATIVE);

        /*
         * Add alternatives to the menu
         */
        menu.addIntentOptions(
            Menu.CATEGORY_ALTERNATIVE,  // Add the Intents as options in the alternatives group.
            Menu.NONE,                  // A unique item ID is not required.
            Menu.NONE,                  // The alternatives don't need to be in order.
            null,                       // The caller's name is not excluded from the group.
            specifics,                  // These specific options must appear first.
            intent,                     // These Intent objects map to the options in specifics.
            Menu.NONE,                  // No flags are required.
            items                       // The menu items generated from the specifics-to-
                                        // Intents mapping
        );
            // If the Edit menu item exists, adds shortcuts for it.
            if (items[0] != null) {

                // Sets the Edit menu item shortcut to numeric "1", letter "e"
                items[0].setShortcut('1', 'e');
            }
        } else {
            // If the list is empty, removes any existing alternative actions from the menu
            menu.removeGroup(Menu.CATEGORY_ALTERNATIVE);
        }

    // Displays the menu
    return true;
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:79,代碼來源:NotesList.java

示例8: onClick

@Override
public void onClick(DialogInterface dialog, int position) {
    switch (position) {
        case DialogInterface.BUTTON_NEGATIVE:
            try {
                Intent calendar_intent = new Intent(Intent.ACTION_EDIT);
                calendar_intent.setType("vnd.android.cursor.item/event");
                calendar_intent.putExtra("beginTime", selectedEvent
                        .getStartDate().getTime());
                calendar_intent.putExtra("allDay", true);
                calendar_intent.putExtra("endTime", selectedEvent.getEndDate()
                        .getTime() + 60 * 60 * 1000);
                calendar_intent.putExtra("title", selectedEvent.getEvent());
                getContext().startActivity(calendar_intent);
            } catch (Exception e) {
                Toast.makeText(getContext(), R.string.calendar_not_support,
                        Toast.LENGTH_SHORT).show();
            }
            break;
        case DialogInterface.BUTTON_POSITIVE:
            String shareBody = null;
            if (selectedEvent.getStartDate().compareTo(
                    selectedEvent.getEndDate()) == 0) {
                shareBody = Utility.getDateString("yyyy/MM/dd (E)",
                        selectedEvent.getStartDate(), getContext())
                        + " "
                        + selectedEvent.getEvent();
            } else {
                shareBody = Utility.getDateString("yyyy/MM/dd (E)",
                        selectedEvent.getStartDate(), getContext())
                        + "~"
                        + Utility.getDateString("yyyy/MM/dd (E)",
                        selectedEvent.getEndDate(), getContext())
                        + " "
                        + selectedEvent.getEvent();
            }
            Intent sharing_intent = new Intent(
                    android.content.Intent.ACTION_SEND);
            sharing_intent.setType("text/plain");
            sharing_intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "");
            sharing_intent.putExtra(android.content.Intent.EXTRA_TEXT,
                    shareBody);
            getContext().startActivity(
                    Intent.createChooser(sharing_intent, getContext()
                            .getResources().getString(R.string.share_using)));
            break;
    }
}
 
開發者ID:kamisakihideyoshi,項目名稱:TaipeiTechRefined,代碼行數:48,代碼來源:CalendarListAdapter.java

示例9: getSQLiteDebuggerAppIntent

private static Intent getSQLiteDebuggerAppIntent(String path) {
    Intent intent = new Intent(Intent.ACTION_EDIT);
    intent.setData(Uri.parse("sqlite:" + path));
    return intent;
}
 
開發者ID:jgilfelt,項目名稱:chuck,代碼行數:5,代碼來源:SQLiteUtils.java


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