Java Code Examples for android.content.Intent.ACTION_EDIT

The following are Jave code examples for showing how to use ACTION_EDIT of the android.content.Intent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Linphone4Android   File: ApiElevenPlus.java   View Source Code Vote up 7 votes
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;
}
 
Example 2
Project: Amaro   File: DoctorPage.java   View Source Code Vote up 7 votes
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);
}
 
Example 3
Project: referendum_1o_android   File: VoteFragment.java   View Source Code Vote up 7 votes
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);
}
 
Example 4
Project: Camera-Roll-Android-App   File: IntentReceiver.java   View Source Code Vote up 7 votes
@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;
    }
}
 
Example 5
Project: PictureShow   File: PicShowUtils.java   View Source Code Vote up 6 votes
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)));
}
 
Example 6
Project: diary   File: Diary.java   View Source Code Vote up 6 votes
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);
}
 
Example 7
Project: buildAPKsSamples   File: NotesList.java   View Source Code Vote up 5 votes
@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;
}
 
Example 8
Project: TaipeiTechRefined   File: CalendarListAdapter.java   View Source Code Vote up 5 votes
@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;
    }
}
 
Example 9
Project: chuck   File: SQLiteUtils.java   View Source Code Vote up 5 votes
private static Intent getSQLiteDebuggerAppIntent(String path) {
    Intent intent = new Intent(Intent.ACTION_EDIT);
    intent.setData(Uri.parse("sqlite:" + path));
    return intent;
}