本文整理汇总了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;
}
}
示例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;
}
示例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);
}
示例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);
}
示例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)));
}
示例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);
}
示例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;
}
示例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;
}
}
示例9: getSQLiteDebuggerAppIntent
private static Intent getSQLiteDebuggerAppIntent(String path) {
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setData(Uri.parse("sqlite:" + path));
return intent;
}