当前位置: 首页>>代码示例>>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;未经允许,请勿转载。