List of usage examples for android.content Intent ACTION_INSERT_OR_EDIT
String ACTION_INSERT_OR_EDIT
To view the source code for android.content Intent ACTION_INSERT_OR_EDIT.
Click Source Link
From source file:Main.java
public static void addToFacebookContact(Context mContext, ArrayList<String> contactDatas) { /**//from w w w . jav a2 s . c om * ArrayList elements: * * 1. Name 2. Userid 3.Username */ Intent i = new Intent(Intent.ACTION_INSERT_OR_EDIT); i.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE); if (contactDatas.get(2) == null) { contactDatas.set(2, "Facebook name"); } ArrayList<ContentValues> data = new ArrayList<ContentValues>(); ContentValues row1 = new ContentValues(); row1.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE); row1.put(ContactsContract.Data.DATA1, contactDatas.get(2)); row1.put(ContactsContract.Data.DATA2, ContactsContract.CommonDataKinds.Im.TYPE_OTHER); row1.put(ContactsContract.Data.DATA5, ContactsContract.CommonDataKinds.Im.PROTOCOL_CUSTOM); row1.put(ContactsContract.Data.DATA6, "Facebook"); row1.put(ContactsContract.Data.DATA10, contactDatas.get(1)); data.add(row1); i.putExtra(Insert.NAME, contactDatas.get(0)); i.putParcelableArrayListExtra(ContactsContract.Intents.Insert.DATA, data); mContext.startActivity(i); }
From source file:Main.java
/** * @brief Get the intent to add email address to existed contact. * * @par Sync (or) Async://w ww .j a v a 2s . co m * This is a Synchronous function. * * @param [IN] email email address.\n * * @return * * @author daiping.zhao * @since 1.0.0.0 * @version 1.0.0.0 * @par Prospective Clients: * External Classes */ public static Intent doAddEmaliToExistContact(String email) { Intent newIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT, Contacts.CONTENT_URI); newIntent.setType(Contacts.CONTENT_ITEM_TYPE); newIntent.putExtra(Intents.Insert.EMAIL, email); return newIntent; }
From source file:Main.java
/** * @brief Get the intent to add telephone number into contact. * * @par Sync (or) Async:/*w ww . ja va 2 s .com*/ * This is a Synchronous function. * * @param [IN] telNumber Telephone number.\n * * @return * * @author daiping.zhao * @since 1.0.0.0 * @version 1.0.0.0 * @par Prospective Clients: * External Classes */ public static Intent doAddTelToExistContact(String telNumber) { Intent newIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT, Contacts.CONTENT_URI); newIntent.setType(Contacts.CONTENT_ITEM_TYPE); newIntent.putExtra(Intents.Insert.PHONE, telNumber); return newIntent; }
From source file:Main.java
public static Intent getAddToContactIntent(CharSequence name, CharSequence phoneNumber, int phoneNumberType) { Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); intent.putExtra(Intents.Insert.PHONE, phoneNumber); // Only include the name and phone type extras if they are specified (the method // getAddNumberToContactIntent does not use them). if (name != null) { intent.putExtra(Intents.Insert.NAME, name); }// www . j ava 2s.co m if (phoneNumberType != -1) { intent.putExtra(Intents.Insert.PHONE_TYPE, phoneNumberType); } intent.setType(Contacts.CONTENT_ITEM_TYPE); return intent; }
From source file:com.appunite.helpers.EditFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getActivity().getIntent(); String action = intent.getAction(); mDiscard = false;/*from ww w . jav a2s . c o m*/ if (savedInstanceState != null) { mUri = savedInstanceState.getParcelable(STATE_URI); checkState(mUri != null); mIsEdit = savedInstanceState.getBoolean(STATE_IS_EDIT); } else if (Intent.ACTION_INSERT.equals(action) || Intent.ACTION_INSERT_OR_EDIT.equals(action)) { mUri = intent.getData(); if (mUri == null) { mUri = getInsertionUri(); } checkArgument(mUri != null); mIsEdit = false; } else if (Intent.ACTION_EDIT.equals(action)) { mUri = intent.getData(); checkArgument(mUri != null); mIsEdit = true; } else { throw new IllegalArgumentException("Unknown action: " + action); } }
From source file:org.gnucash.android.ui.budget.BudgetsActivity.java
/** * Callback when create budget floating action button is clicked * @param view View which was clicked/*from ww w . ja v a 2 s . co m*/ */ public void onCreateBudgetClick(View view) { Intent addAccountIntent = new Intent(BudgetsActivity.this, FormActivity.class); addAccountIntent.setAction(Intent.ACTION_INSERT_OR_EDIT); addAccountIntent.putExtra(UxArgument.FORM_TYPE, FormActivity.FormType.BUDGET.name()); startActivityForResult(addAccountIntent, REQUEST_CREATE_BUDGET); }
From source file:org.gnucash.android.ui.transactions.TransactionsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_transactions); final Intent intent = getIntent(); mAccountId = intent.getLongExtra(TransactionsListFragment.SELECTED_ACCOUNT_ID, -1); setupActionBarNavigation();//from ww w. ja v a 2 s . c o m if (intent.getAction().equals(Intent.ACTION_INSERT_OR_EDIT)) { long transactionId = intent.getLongExtra(NewTransactionFragment.SELECTED_TRANSACTION_ID, -1); if (transactionId <= 0) { createNewTransaction(mAccountId); } else { editTransaction(transactionId); } } else { //load the transactions list FragmentManager fragmentManager = getSupportFragmentManager(); TransactionsListFragment transactionsListFragment = (TransactionsListFragment) fragmentManager .findFragmentByTag(FRAGMENT_TRANSACTIONS_LIST); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); transactionsListFragment = new TransactionsListFragment(); Bundle args = new Bundle(); args.putLong(TransactionsListFragment.SELECTED_ACCOUNT_ID, mAccountId); transactionsListFragment.setArguments(args); Log.i(TAG, "Opening transactions for account id " + mAccountId); fragmentTransaction.replace(R.id.fragment_container, transactionsListFragment, FRAGMENT_TRANSACTIONS_LIST); fragmentTransaction.commit(); } // done creating, activity now running mActivityRunning = true; }
From source file:com.appjma.appdeployer.AppsFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int itemId = item.getItemId(); switch (itemId) { case R.id.menu_refresh: mDownloadHelper.startDownloading(null, true); return true; case R.id.menu_add: startActivity(new Intent(Intent.ACTION_INSERT_OR_EDIT, AppContract.Apps.CONTENT_URI)); return true; default:/*from ww w .jav a 2 s . co m*/ return super.onOptionsItemSelected(item); } }
From source file:org.gnucash.android.ui.budget.BudgetDetailFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_edit_budget: Intent addAccountIntent = new Intent(getActivity(), FormActivity.class); addAccountIntent.setAction(Intent.ACTION_INSERT_OR_EDIT); addAccountIntent.putExtra(UxArgument.FORM_TYPE, FormActivity.FormType.BUDGET.name()); addAccountIntent.putExtra(UxArgument.BUDGET_UID, mBudgetUID); startActivityForResult(addAccountIntent, 0x11); return true; default://from w w w. jav a 2 s .com return false; } }
From source file:org.gnucash.android.ui.budget.BudgetListFragment.java
/** * Launches the FormActivity for editing the budget * @param budgetId Db record Id of the budget *//*from w w w. j av a2 s . co m*/ private void editBudget(long budgetId) { Intent addAccountIntent = new Intent(getActivity(), FormActivity.class); addAccountIntent.setAction(Intent.ACTION_INSERT_OR_EDIT); addAccountIntent.putExtra(UxArgument.FORM_TYPE, FormActivity.FormType.BUDGET.name()); addAccountIntent.putExtra(UxArgument.BUDGET_UID, mBudgetsDbAdapter.getUID(budgetId)); startActivityForResult(addAccountIntent, REQUEST_EDIT_BUDGET); }