List of usage examples for android.content Intent ACTION_EDIT
String ACTION_EDIT
To view the source code for android.content Intent ACTION_EDIT.
Click Source Link
From source file:org.opendatakit.tables.utils.CollectUtil.java
/** * Return an intent that can be used to edit a row. * <p>/*from ww w .ja v a 2 s. co m*/ * The idea here is that we might want to edit a row of the table using a * pre-set Collect form. This form would be user-defined and would be a more * user-friendly thing that would display only the pertinent information for a * particular user. * * @param context * @param tp * @param elementKeyToValue * @param params * @return */ private static Intent getIntentForOdkCollectEditRow(Context context, String appName, String tableId, ArrayList<ColumnDefinition> orderedDefns, Map<String, String> elementKeyToValue, CollectFormParameters params, String rowId) { // Check if there is a custom form. If there is not, we want to delete // the old form and write the new form. if (!params.isCustom()) { boolean formIsReady = CollectUtil.deleteWriteAndInsertFormIntoCollect(context, appName, tableId, orderedDefns, params); if (!formIsReady) { WebLogger.getLogger(appName).e(TAG, "could not delete, write, or insert a generated form"); return null; } } boolean shouldUpdate = CollectUtil.isExistingCollectInstanceForRowData(context, appName, tableId, rowId); boolean writeDataSuccessful = CollectUtil.writeRowDataToBeEdited(context, appName, tableId, orderedDefns, elementKeyToValue, params, rowId); if (!writeDataSuccessful) { WebLogger.getLogger(appName).e(TAG, "could not write instance file successfully!"); } Uri insertUri = CollectUtil.getUriForCollectInstanceForRowData(context, appName, tableId, params, rowId, shouldUpdate); // Copied the below from getIntentForOdkCollectEditRow(). Intent intent = new Intent(); intent.setComponent(new ComponentName("org.odk.collect.android", "org.odk.collect.android.activities.FormEntryActivity")); intent.setAction(Intent.ACTION_EDIT); intent.setData(insertUri); // intent.putExtra("start", true); // jump right into form return intent; }
From source file:com.nononsenseapps.notepad.MainActivity.java
@Override public void onItemSelected(long id) { Log.d(TAG, "onItemSelected: " + id); // Open a note if (id > -1) { if (getCurrentContent().equals(DualLayoutActivity.CONTENTVIEW.DUAL)) { Bundle arguments = new Bundle(); arguments.putLong(NotesEditorFragment.KEYID, id); NotesEditorFragment fragment = new NotesEditorFragment(); fragment.setArguments(arguments); getFragmentManager().beginTransaction().replace(R.id.rightFragment, fragment) .commitAllowingStateLoss(); } else {//ww w .ja va2 s . c om Intent intent = new Intent(); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setClass(this, RightActivity.class) .setData(Uri.withAppendedPath(NotePad.Notes.CONTENT_VISIBLE_ID_URI_BASE, Long.toString(id))) .setAction(Intent.ACTION_EDIT); startActivity(intent); } } }
From source file:com.Beat.RingdroidEditActivity.java
private void chooseContactForRingtone(Uri uri) { try {//from w w w . j a v a 2 s . c om Intent intent = new Intent(Intent.ACTION_EDIT, uri); intent.setClassName("com.Beat", "com.Beat.ChooseContactActivity"); startActivityForResult(intent, REQUEST_CODE_CHOOSE_CONTACT); } catch (Exception e) { Log.e("Ringdroid", "Couldn't open Choose Contact window"); } }
From source file:org.openintents.notepad.NoteEditor.java
private void importNote() { // Load the file into a new note. mFileContent = mText.getText().toString(); Uri newUri;//from ww w .ja v a2 s . c om // Let's check whether the exactly same note already exists or not: Cursor c = getContentResolver().query(Notes.CONTENT_URI, new String[] { Notes._ID }, Notes.NOTE + " = ?", new String[] { mFileContent }, null); if (c != null && c.moveToFirst()) { // Same note exists already: long id = c.getLong(0); newUri = ContentUris.withAppendedId(Notes.CONTENT_URI, id); } else { // Add new note // Requested to insert: set that state, and create a new entry // in the container. // mState = STATE_INSERT; ContentValues values = new ContentValues(); values.put(Notes.NOTE, mFileContent); values.put(Notes.THEME, mTheme); newUri = getContentResolver().insert(Notes.CONTENT_URI, values); // If we were unable to create a new note, then just finish // this activity. A RESULT_CANCELED will be sent back to the // original activity if they requested a result. if (newUri == null) { Log.e(TAG, "Failed to insert new note."); finish(); return; } // The new entry was created, so assume all will end well and // set the result to be returned. // setResult(RESULT_OK, (new Intent()).setAction(mUri.toString())); // setResult(RESULT_OK, intent); } // Start a new editor: Intent intent = new Intent(); intent.setAction(Intent.ACTION_EDIT); intent.setData(newUri); intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); setIntent(intent); startActivity(intent); // and finish this editor finish(); }
From source file:com.android.calendar.EventInfoFragment.java
private void doEdit() { Context c = getActivity();// ww w . j a v a2 s .c o m // This ensures that we aren't in the process of closing and have been // unattached already if (c != null) { Uri uri = ContentUris.withAppendedId(Events.CONTENT_URI, mEventId); Intent intent = new Intent(Intent.ACTION_EDIT, uri); intent.setClass(mActivity, EditEventActivity.class); intent.putExtra(EXTRA_EVENT_BEGIN_TIME, mStartMillis); intent.putExtra(EXTRA_EVENT_END_TIME, mEndMillis); intent.putExtra(EXTRA_EVENT_ALL_DAY, mAllDay); intent.putExtra(EditEventActivity.EXTRA_EVENT_COLOR, mCurrentColor); intent.putExtra(EditEventActivity.EXTRA_EVENT_REMINDERS, EventViewUtils .reminderItemsToReminders(mReminderViews, mReminderMinuteValues, mReminderMethodValues)); intent.putExtra(EVENT_EDIT_ON_LAUNCH, true); startActivity(intent); } }
From source file:org.opendatakit.tables.utils.CollectUtil.java
/** * Return an intent that can be launched to add a row. * * @param context//from w ww. ja v a 2 s .c om * @param tp * @param params * @param elementKeyToValue * values with which you want to prepopulate the add row form. * @return */ public static Intent getIntentForOdkCollectAddRow(Context context, String appName, String tableId, ArrayList<ColumnDefinition> orderedDefns, CollectFormParameters params, Map<String, String> elementKeyToValue) { /* * So, there are several things to check here. The first thing we want to do * is see if a custom form has been defined for this table. If there is not, * then we will need to write a custom one. When we do this, we will then * have to call delete on Collect to remove the old form, which may have * used the same id. This will not fail if a form has not been already been * written--delete will simply return 0. */ // Check if there is a custom form. If there is not, we want to delete // the old form and write the new form. if (!params.isCustom()) { boolean formIsReady = CollectUtil.deleteWriteAndInsertFormIntoCollect(context, appName, tableId, orderedDefns, params); if (!formIsReady) { WebLogger.getLogger(appName).e(TAG, "could not delete, write, or insert a generated form"); return null; } } // manufacture a rowId for this record... String rowId = "uuid:" + UUID.randomUUID().toString(); boolean shouldUpdate = CollectUtil.isExistingCollectInstanceForRowData(context, appName, tableId, rowId); // emit the empty or partially-populated instance // we've received some values to prepopulate the add row with. boolean writeDataSuccessful = CollectUtil.writeRowDataToBeEdited(context, appName, tableId, orderedDefns, elementKeyToValue, params, rowId); if (!writeDataSuccessful) { WebLogger.getLogger(appName).e(TAG, "could not write instance file successfully!"); } // Here we'll just act as if we're inserting 0, which // really doesn't matter? Uri formToLaunch = CollectUtil.getUriForCollectInstanceForRowData(context, appName, tableId, params, rowId, shouldUpdate); // And now finally create the intent. Intent intent = new Intent(); intent.setComponent(new ComponentName("org.odk.collect.android", "org.odk.collect.android.activities.FormEntryActivity")); intent.setAction(Intent.ACTION_EDIT); intent.setData(formToLaunch); intent.putExtra("start", true); // jump right into form return intent; }
From source file:org.odk.collect.android.activities.FormEntryActivity.java
/** * Returns the instance that was just filled out to the calling activity, if * requested.//from ww w. j a v a 2s .c om */ private void finishReturnInstance() { FormController formController = Collect.getInstance().getFormController(); String action = getIntent().getAction(); if (Intent.ACTION_PICK.equals(action) || Intent.ACTION_EDIT.equals(action)) { // caller is waiting on a picked form Cursor c = null; try { c = new InstancesDao() .getInstancesCursorForFilePath(formController.getInstancePath().getAbsolutePath()); if (c.getCount() > 0) { // should only be one... c.moveToFirst(); String id = c.getString(c.getColumnIndex(InstanceColumns._ID)); Uri instance = Uri.withAppendedPath(InstanceColumns.CONTENT_URI, id); setResult(RESULT_OK, new Intent().setData(instance)); } } finally { if (c != null) { c.close(); } } } finish(); }
From source file:com.kll.collect.android.activities.FormEntryActivity.java
/** * Returns the instance that was just filled out to the calling activity, if * requested.// w w w .j av a2s . co m */ private void finishReturnInstance() { FormController formController = Collect.getInstance().getFormController(); String action = getIntent().getAction(); if (Intent.ACTION_PICK.equals(action) || Intent.ACTION_EDIT.equals(action)) { // caller is waiting on a picked form String selection = InstanceColumns.INSTANCE_FILE_PATH + "=?"; String[] selectionArgs = { formController.getInstancePath().getAbsolutePath() }; Cursor c = null; try { c = getContentResolver().query(InstanceColumns.CONTENT_URI, null, selection, selectionArgs, null); if (c.getCount() > 0) { // should only be one... c.moveToFirst(); String id = c.getString(c.getColumnIndex(InstanceColumns._ID)); Uri instance = Uri.withAppendedPath(InstanceColumns.CONTENT_URI, id); setResult(RESULT_OK, new Intent().setData(instance)); } } finally { if (c != null) { c.close(); } } } finish(); }
From source file:edu.cmu.cylab.starslinger.view.HomeActivity.java
private void showEditContact(int requestCode) { String contactLookupKey = SafeSlingerPrefs.getContactLookupKey(); Uri personUri = getPersonUri(contactLookupKey); if (personUri != null) { Intent intent = new Intent(Intent.ACTION_EDIT, personUri); boolean actionAvailable = getPackageManager().resolveActivity(intent, 0) != null; if (actionAvailable) { startActivityForResult(intent, requestCode); } else {//from ww w . ja v a 2 s. c o m showNote(SafeSlinger.getUnsupportedFeatureString("Edit Contact")); } } else { showNote(R.string.error_ContactUpdateFailed); } }
From source file:com.cognizant.trumobi.PersonaLauncher.java
void editShirtcut(PersonaApplicationInfo info) { Intent edit = new Intent(Intent.ACTION_EDIT); edit.setClass(this, PersonaCustomShirtcutActivity.class); edit.putExtra(PersonaCustomShirtcutActivity.EXTRA_APPLICATIONINFO, info.id); startActivityForResult(edit, REQUEST_EDIT_SHIRTCUT); }