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:com.money.manager.ex.notifications.SmsReceiverTransactions.java
@Override public void onReceive(Context context, Intent intent) { mContext = context.getApplicationContext(); final BehaviourSettings behav_settings = new BehaviourSettings(mContext); final GeneralSettings gen_settings = new GeneralSettings(mContext); final AppSettings app_settings = new AppSettings(mContext); final PreferenceConstants prf_const = new PreferenceConstants(); //App Settings int baseCurencyID, fromCurrencyID, toCurrencyID; int baseAccountID, fromAccountID, toAccountID; String baseCurrencySymbl, fromAccCurrencySymbl, toAccCurrencySymbl; String baseAccountName, fromAccountName, toAccountName; Boolean autoTransactionStatus = false; Boolean skipSaveTrans = false; try {// w w w . j a v a 2 s . c om //------- if settings enabled the parse the sms and create trans --------------- if (behav_settings.getBankSmsTrans() == true) { //---get the SMS message passed in--- Bundle bundle = intent.getExtras(); SmsMessage[] msgs = null; String msgBody = ""; String msgSender = ""; if (bundle != null) { //---retrieve the SMS message received--- Object[] pdus = (Object[]) bundle.get("pdus"); msgs = new SmsMessage[pdus.length]; for (int i = 0; i < msgs.length; i++) { msgs[i] = SmsMessage.createFromPdu((byte[]) pdus[i]); msgSender = msgs[i].getOriginatingAddress(); msgBody += msgs[i].getMessageBody().toString(); } //msgSender = "AT-SIBSMS"; if (isTransactionSms(msgSender)) { // Transaction Sms sender will have format like this AT-SIBSMS, // Promotional sms will have sender like AT-012345 // Not sure how this format will be in out side of India. May I need to update if i get sample ITransactionEntity model = AccountTransaction.create(); mCommon = new EditTransactionCommonFunctions(null, model, database); // find out the trans type using reg ex String[] key_credit_search = { "(credited)", "(received)", "(added)", "(reloaded)", "(deposited)", "(refunded)", "(debited)(.*?)(towards)(\\s)", "(\\s)(received)(.*?)(in(\\s)your)(\\s)", "(sent)(.*?)(to)(\\s)", "(debited)(.*?)(to)(\\s)", "(credited)(.*?)(in)(\\s)", "(credited)(.*?)(to)(\\s)" }; String[] key_debit_search = { "(made)", "(debited)", "(using)", "(paid)", "(purchase)", "(withdrawn)", "(credited)(.*?)(from)(\\s)", "(sent)(.*?)(from)(\\s)", "(\\s)(received)(.*?)(from)(\\s)" }; String transType = ""; Boolean isDeposit = validateTransType(key_credit_search, msgBody.toLowerCase()); Boolean isWithdrawal = validateTransType(key_debit_search, msgBody.toLowerCase()); if (isDeposit == true) { if (isWithdrawal == true) { transType = "Transfer"; String[] transCategory = getCategoryOrSubCategoryByName("Transfer"); if (!transCategory[0].isEmpty()) { mCommon.transactionEntity.setCategoryId(parseInt(transCategory[0])); } if (!transCategory[1].isEmpty()) { mCommon.transactionEntity.setSubcategoryId(parseInt(transCategory[1])); } mCommon.transactionEntity.setTransactionType(TransactionTypes.Transfer); } else { transType = "Deposit"; String[] incomeCategory = getCategoryOrSubCategoryByName("Income"); if (!incomeCategory[0].isEmpty()) { mCommon.transactionEntity.setCategoryId(parseInt(incomeCategory[0])); } if (!incomeCategory[1].isEmpty()) { mCommon.transactionEntity.setSubcategoryId(parseInt(incomeCategory[1])); } mCommon.transactionEntity.setTransactionType(TransactionTypes.Deposit); } } else if (isWithdrawal == true) { transType = "Withdrawal"; mCommon.transactionEntity.setTransactionType(TransactionTypes.Withdrawal); } mCommon.transactionEntity.setStatus(""); mCommon.payeeName = ""; if (transType != "" && msgBody.toLowerCase().contains("otp") == false) { // if not from blank, then nothing to do with sms //Create the intent thatll fire when the user taps the notification// Intent t_intent = new Intent(mContext, CheckingTransactionEditActivity.class); // Db setup MmxHelper = new MmxOpenHelper(mContext, app_settings.getDatabaseSettings().getDatabasePath()); db = MmxHelper.getReadableDatabase(); baseCurencyID = gen_settings.getBaseCurrencytId(); baseAccountID = gen_settings.getDefaultAccountId(); baseAccountName = ""; fromAccountID = -1; fromCurrencyID = -1; fromAccountName = ""; //if default account id selected if (baseAccountID > 0) { fromAccountID = baseAccountID; fromAccountName = baseAccountName; fromCurrencyID = baseCurencyID; } //Get the base currency sysmbl baseCurrencySymbl = getCurrencySymbl(baseCurencyID); fromAccCurrencySymbl = baseCurrencySymbl; //get te from acount details extractAccountDetails(msgBody, transType); if (!fromAccountDetails[0].isEmpty()) { fromAccountID = parseInt(fromAccountDetails[0]); fromAccountName = fromAccountDetails[1]; fromCurrencyID = parseInt(fromAccountDetails[2]); fromAccCurrencySymbl = fromAccountDetails[3]; mCommon.transactionEntity.setAccountId(fromAccountID); } mCommon.transactionEntity.setNotes(msgBody); mCommon.transactionEntity.setDate(new MmxDate().toDate()); //get the trans amount String transAmount = extractTransAmount(msgBody, fromAccCurrencySymbl); String[] transPayee = extractTransPayee(msgBody); //If there is no account no. or payee in the msg & no amt, then this is not valid sms to do transaction if ((!fromAccountDetails[6].isEmpty() || !toAccountDetails[6].isEmpty() || !transPayee[0].isEmpty()) && !transAmount.isEmpty()) { mCommon.transactionEntity.setAmount(MoneyFactory.fromString(transAmount)); String transRefNo = extractTransRefNo(msgBody); //set the ref no. if exists if (!transRefNo.isEmpty()) { mCommon.transactionEntity.setTransactionNumber(transRefNo); } int txnId = getTxnId(transRefNo.trim(), mCommon.transactionEntity.getDateString()); switch (txnId) { case 0: //add new trnsaction if (transType == "Transfer") //if it is transfer { if (!toAccountDetails[0].isEmpty()) // if id exists then considering as account transfer { toAccountID = parseInt(toAccountDetails[0]); toAccountName = toAccountDetails[1]; toCurrencyID = parseInt(toAccountDetails[2]); toAccCurrencySymbl = toAccountDetails[3]; mCommon.transactionEntity.setAccountToId(toAccountID); //convert the to amount from the both currency details CurrencyService currencyService = new CurrencyService(mContext); mCommon.transactionEntity .setAmountTo(currencyService.doCurrencyExchange(fromCurrencyID, mCommon.transactionEntity.getAmount(), toCurrencyID)); mCommon.transactionEntity.setPayeeId(Constants.NOT_SET); } else { // if not, then IMPS transfer tp 3rd party transType = "Withdrawal"; mCommon.transactionEntity .setTransactionType(TransactionTypes.Withdrawal); mCommon.transactionEntity.setAccountToId(Constants.NOT_SET); mCommon.transactionEntity .setAmountTo(MoneyFactory.fromString(transAmount)); //if there is no to account found from mmex db, then check for payee //This will helps me to handle 3rd party transfer thru IMPS if (!toAccountDetails[6].isEmpty() && transPayee[0].isEmpty()) { transPayee = getPayeeDetails(toAccountDetails[6].trim()); } } } else { mCommon.transactionEntity.setAccountToId(Constants.NOT_SET); mCommon.transactionEntity.setAmountTo(MoneyFactory.fromString(transAmount)); } if (!transPayee[0].isEmpty()) { mCommon.transactionEntity.setPayeeId(parseInt(transPayee[0])); mCommon.payeeName = transPayee[1]; mCommon.transactionEntity.setCategoryId(parseInt(transPayee[2])); mCommon.transactionEntity.setSubcategoryId(parseInt(transPayee[3])); } t_intent.setAction(Intent.ACTION_INSERT); //Set the action break; default: //Update existing transaction transType = "Transfer"; AccountTransactionRepository repo = new AccountTransactionRepository(mContext); AccountTransaction txn = repo.load(txnId); if (txn != null) { if (txn.getTransactionType() != TransactionTypes.Transfer) { AccountRepository accountRepository = new AccountRepository(mContext); if (txn.getTransactionType() == TransactionTypes.Deposit) { toAccountID = txn.getAccountId(); toCurrencyID = accountRepository .loadCurrencyIdFor(txn.getAccountId()); } else { toAccountID = fromAccountID; toCurrencyID = fromCurrencyID; fromCurrencyID = accountRepository .loadCurrencyIdFor(txn.getAccountId()); } mCommon.transactionEntity = txn; mCommon.transactionEntity.setTransactionType(TransactionTypes.Transfer); mCommon.transactionEntity.setAccountId(fromAccountID); mCommon.transactionEntity.setAccountToId(toAccountID); //convert the to amount from the both currency details CurrencyService currencyService = new CurrencyService(mContext); mCommon.transactionEntity .setAmountTo(currencyService.doCurrencyExchange(fromCurrencyID, mCommon.transactionEntity.getAmount(), toCurrencyID)); mCommon.transactionEntity.setPayeeId(Constants.NOT_SET); String[] transCategory = getCategoryOrSubCategoryByName("Transfer"); if (!transCategory[0].isEmpty()) { mCommon.transactionEntity.setCategoryId(parseInt(transCategory[0])); mCommon.transactionEntity .setSubcategoryId(parseInt(transCategory[1])); } mCommon.transactionEntity.setNotes( mCommon.transactionEntity.getNotes() + "\n\n" + msgBody); t_intent.setAction(Intent.ACTION_EDIT); //Set the action } else //if transfer already exists, then do nothing { skipSaveTrans = true; } } } // Capture the details the for Toast String strExtracted = "Account = " + fromAccountName + "-" + fromAccountDetails[6] + "\n" + "Trans Amt = " + fromAccCurrencySymbl + " " + transAmount + ",\n" + "Payyee Name= " + transPayee[1] + "\n" + "Category ID = " + transPayee[2] + "\n" + "Sub Category ID = " + transPayee[3] + "\n" + "Trans Ref No. = " + transRefNo + "\n" + "Trans Type = " + transType + "\n"; //Must be commented for released version //mCommon.transactionEntity.setNotes(strExtracted); // Set the content for a transaction); t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_SOURCE, "SmsReceiverTransactions.java"); t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_ID, mCommon.transactionEntity.getId()); t_intent.putExtra(EditTransactionActivityConstants.KEY_ACCOUNT_ID, String.valueOf(mCommon.transactionEntity.getAccountId())); t_intent.putExtra(EditTransactionActivityConstants.KEY_TO_ACCOUNT_ID, String.valueOf(mCommon.transactionEntity.getAccountToId())); t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_CODE, mCommon.getTransactionType()); t_intent.putExtra(EditTransactionActivityConstants.KEY_PAYEE_ID, String.valueOf(mCommon.transactionEntity.getPayeeId())); t_intent.putExtra(EditTransactionActivityConstants.KEY_PAYEE_NAME, mCommon.payeeName); t_intent.putExtra(EditTransactionActivityConstants.KEY_CATEGORY_ID, String.valueOf(mCommon.transactionEntity.getCategoryId())); t_intent.putExtra(EditTransactionActivityConstants.KEY_SUBCATEGORY_ID, String.valueOf(mCommon.transactionEntity.getSubcategoryId())); t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_AMOUNT, String.valueOf(mCommon.transactionEntity.getAmount())); t_intent.putExtra(EditTransactionActivityConstants.KEY_NOTES, mCommon.transactionEntity.getNotes()); t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_DATE, new MmxDate().toDate()); t_intent.putExtra(EditTransactionActivityConstants.KEY_TRANS_NUMBER, mCommon.transactionEntity.getTransactionNumber()); // validate and save the transaction if (skipSaveTrans == false) { if (validateData()) { if (saveTransaction()) { Toast.makeText(context, "MMEX: Bank Transaction Processed for: \n\n" + strExtracted, Toast.LENGTH_LONG).show(); autoTransactionStatus = true; } } //if transaction is not created automatically, then invoke notification or activity screen if (autoTransactionStatus == false) { startActivity(mContext, t_intent, null); //showNotification(t_intent, strExtracted); } } else { Toast.makeText(context, "MMEX: Skiping Bank Transaction updates SMS, because transaction exists with ref. no. " + transRefNo, Toast.LENGTH_LONG).show(); } //reset the value msgBody = ""; msgSender = ""; bundle = null; msgs = null; mCommon = null; skipSaveTrans = false; } } } } } } catch (Exception e) { Timber.e(e, "MMEX: Bank Transaction Process EXCEPTION"); } }
From source file:com.slim.turboeditor.activity.MainActivity.java
/** * Parses the intent// www . j a va2s . c o m */ private void parseIntent(Intent intent) { final String action = intent.getAction(); final String type = intent.getType(); if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_EDIT.equals(action) || Intent.ACTION_PICK.equals(action) && type != null) { Uri uri = intent.getData(); File newFile = new File(uri.getPath()); newFileToOpen(newFile, ""); } else if (Intent.ACTION_SEND.equals(action) && type != null) { if ("text/plain".equals(type)) { newFileToOpen(null, intent.getStringExtra(Intent.EXTRA_TEXT)); } } }
From source file:com.money.manager.ex.account.AccountTransactionListFragment.java
private void initializeListHeader(LayoutInflater inflater) { this.viewHolder.listHeader = (ViewGroup) inflater.inflate(R.layout.account_header_fragment, null, false); // take reference text view from layout this.viewHolder.txtAccountBalance = (TextView) this.viewHolder.listHeader .findViewById(R.id.textViewAccountBalance); this.viewHolder.txtAccountReconciled = (TextView) this.viewHolder.listHeader .findViewById(R.id.textViewAccountReconciled); this.viewHolder.txtAccountDifference = (TextView) this.viewHolder.listHeader .findViewById(R.id.textViewDifference); // favorite icon this.viewHolder.imgAccountFav = (ImageView) this.viewHolder.listHeader .findViewById(R.id.imageViewAccountFav); // set listener click on favorite icon for change image this.viewHolder.imgAccountFav.setOnClickListener(new OnClickListener() { public void onClick(View v) { // set status account mAccount.setFavorite(!(mAccount.getFavorite())); AccountRepository repo = new AccountRepository(getActivity()); boolean updated = repo.save(mAccount); if (!updated) { Toast.makeText(getActivity(), getActivity().getResources().getString(R.string.db_update_failed), Toast.LENGTH_LONG).show(); } else { setImageViewFavorite();/*from ww w . j a va2s. c o m*/ } } }); // goto account this.viewHolder.imgGotoAccount = (ImageView) this.viewHolder.listHeader .findViewById(R.id.imageViewGotoAccount); this.viewHolder.imgGotoAccount.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), AccountEditActivity.class); intent.putExtra(AccountEditActivity.KEY_ACCOUNT_ID, mAccountId); intent.setAction(Intent.ACTION_EDIT); startActivity(intent); } }); }
From source file:com.granita.tasks.TaskListFragment.java
/** * Opens the task editor for the selected Task. * /*from www . j a v a2 s . c o m*/ * @param taskUri * The {@link Uri} of the task. * @param taskTitle * The name/title of the task. */ private void openTaskEditor(final Uri taskUri, final String accountType) { Intent editTaskIntent = new Intent(Intent.ACTION_EDIT); editTaskIntent.setData(taskUri); editTaskIntent.putExtra(EditTaskActivity.EXTRA_DATA_ACCOUNT_TYPE, accountType); startActivity(editTaskIntent); }
From source file:net.gsantner.opoc.util.ShareUtil.java
/** * Try to force extract a absolute filepath from an intent * * @param receivingIntent The intent from {@link Activity#getIntent()} * @return A file or null if extraction did not succeed *//* w w w . j a va 2s . c om*/ public File extractFileFromIntent(Intent receivingIntent) { String action = receivingIntent.getAction(); String type = receivingIntent.getType(); File tmpf; String tmps; String fileStr; if ((Intent.ACTION_VIEW.equals(action) || Intent.ACTION_EDIT.equals(action)) || Intent.ACTION_SEND.equals(action)) { // Markor, S.M.T FileManager if (receivingIntent.hasExtra((tmps = EXTRA_FILEPATH))) { return new File(receivingIntent.getStringExtra(tmps)); } // Analyze data/Uri Uri fileUri = receivingIntent.getData(); if (fileUri != null && (fileStr = fileUri.toString()) != null) { // Uri contains file if (fileStr.startsWith("file://")) { return new File(fileUri.getPath()); } if (fileStr.startsWith((tmps = "content://"))) { fileStr = fileStr.substring(tmps.length()); String fileProvider = fileStr.substring(0, fileStr.indexOf("/")); fileStr = fileStr.substring(fileProvider.length() + 1); // Some file managers dont add leading slash if (fileStr.startsWith("storage/")) { fileStr = "/" + fileStr; } // Some do add some custom prefix for (String prefix : new String[] { "file", "document", "root_files", "name" }) { if (fileStr.startsWith(prefix)) { fileStr = fileStr.substring(prefix.length()); } } // Next/OwnCloud Fileprovider for (String fp : new String[] { "org.nextcloud.files", "org.nextcloud.beta.files", "org.owncloud.files" }) { if (fileProvider.equals(fp) && fileStr.startsWith(tmps = "external_files/")) { return new File(Uri.decode("/storage/" + fileStr.substring(tmps.length()))); } } // AOSP File Manager/Documents if (fileProvider.equals("com.android.externalstorage.documents") && fileStr.startsWith(tmps = "/primary%3A")) { return new File(Uri.decode(Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + fileStr.substring(tmps.length()))); } // Mi File Explorer if (fileProvider.equals("com.mi.android.globalFileexplorer.myprovider") && fileStr.startsWith(tmps = "external_files")) { return new File(Uri.decode(Environment.getExternalStorageDirectory().getAbsolutePath() + fileStr.substring(tmps.length()))); } // URI Encoded paths with full path after content://package/ if (fileStr.startsWith("/") || fileStr.startsWith("%2F")) { tmpf = new File(Uri.decode(fileStr)); if (tmpf.exists()) { return tmpf; } else if ((tmpf = new File(fileStr)).exists()) { return tmpf; } } } } fileUri = receivingIntent.getParcelableExtra(Intent.EXTRA_STREAM); if (fileUri != null && !TextUtils.isEmpty(tmps = fileUri.getPath()) && tmps.startsWith("/") && (tmpf = new File(tmps)).exists()) { return tmpf; } } return null; }
From source file:com.money.manager.ex.investment.watchlist.WatchlistFragment.java
private void initializeListHeader(LayoutInflater inflater) { this.viewHolder.mListHeader = (ViewGroup) inflater.inflate(R.layout.fragment_watchlist_header, null, false); // favorite icon this.viewHolder.imgAccountFav = (ImageView) this.viewHolder.mListHeader .findViewById(R.id.imageViewAccountFav); // set listener click on favorite icon for change image this.viewHolder.imgAccountFav.setOnClickListener(new OnClickListener() { public void onClick(View v) { mAccount.setFavorite(!mAccount.getFavorite()); AccountRepository repo = new AccountRepository(getActivity()); boolean saved = repo.save(mAccount); if (!saved) { Toast.makeText(getActivity(), getActivity().getResources().getString(R.string.db_update_failed), Toast.LENGTH_LONG).show(); } else { setImageViewFavorite();//from w ww. ja v a 2s . c o m } } }); // Edit account this.viewHolder.imgGotoAccount = (ImageView) this.viewHolder.mListHeader .findViewById(R.id.imageViewGotoAccount); this.viewHolder.imgGotoAccount.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), AccountEditActivity.class); intent.putExtra(AccountEditActivity.KEY_ACCOUNT_ID, getAccountId()); intent.setAction(Intent.ACTION_EDIT); startActivity(intent); } }); }
From source file:com.albedinsky.android.support.intent.CalendarIntent.java
/** *//*from w w w. j a va 2 s .c o m*/ @NonNull @Override @SuppressWarnings("ConstantConditions") protected Intent onBuild() { switch (mType) { case TYPE_VIEW: final Uri.Builder builder = CalendarContract.CONTENT_URI.buildUpon(); builder.appendPath("time"); ContentUris.appendId(builder, mBeginTime); return new Intent(Intent.ACTION_VIEW).setData(builder.build()); case TYPE_INSERT_EVENT: return new Intent(Intent.ACTION_INSERT).setData(CalendarContract.Events.CONTENT_URI) .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, mBeginTime) .putExtra(CalendarContract.EXTRA_EVENT_END_TIME, mEndTime) .putExtra(CalendarContract.Events.TITLE, mTitle) .putExtra(CalendarContract.Events.DESCRIPTION, mDescription) .putExtra(CalendarContract.Events.EVENT_LOCATION, mLocation) .putExtra(CalendarContract.Events.AVAILABILITY, mAvailability); case TYPE_EDIT_EVENT: final Intent intent = new Intent(Intent.ACTION_EDIT); intent.setData(ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, mEventId)); if (!TextUtils.isEmpty(mTitle)) { intent.putExtra(CalendarContract.Events.TITLE, mTitle); } return intent; default: return new Intent(Intent.ACTION_VIEW) .setData(ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, mEventId)); } }
From source file:com.granita.tasks.TaskListActivity.java
@Override public void onEditTask(Uri taskUri, ContentSet data) { Intent editTaskIntent = new Intent(Intent.ACTION_EDIT); editTaskIntent.setData(taskUri);/*from w ww . ja va 2s .co m*/ if (data != null) { editTaskIntent.putExtra(EditTaskActivity.EXTRA_DATA_CONTENT_SET, data); } startActivity(editTaskIntent); }
From source file:org.hfoss.posit.android.api.fragment.FindFragment.java
/** * Retrieves values from the View fields and stores them in a Find instance. * This method is invoked from the Save menu item. It also marks the find * 'unsynced' so it will be updated to the server. * //from w ww. j ava2 s.com * @return a new Find object with data from the view. */ protected Find retrieveContentFromView() { // Get the appropriate find class from the plug-in // manager and make an instance of it Class<Find> findClass = FindPluginManager.mFindPlugin.getmFindClass(); Find find = null; if (getAction().equals(Intent.ACTION_EDIT) || getAction().equals(Intent.ACTION_INSERT_OR_EDIT)) { find = mFind; } else { try { find = findClass.newInstance(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (java.lang.InstantiationException e) { e.printStackTrace(); } } // Set GUID // NOTE: Some derived finds may not have a GUID field. But the Guid must // be // set anyway because it used as the Find ID by the Posit server. if (mGuidRealTV != null) { find.setGuid(mGuidRealTV.getText().toString()); } else { find.setGuid(UUID.randomUUID().toString()); } // Set Time if (mTimeTV != null) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); String value = mTimeTV.getText().toString(); if (value.length() == 10) { dateFormat = new SimpleDateFormat("yyyy/MM/dd"); } try { find.setTime(dateFormat.parse(value)); } catch (ParseException e) { e.printStackTrace(); } } // Set Name if (mNameET != null) { find.setName(mNameET.getText().toString()); } // Set Description if (mDescriptionET != null) { find.setDescription(mDescriptionET.getText().toString()); } // Set Longitude and Latitude if (mLatitudeTV != null && mLongitudeTV != null) { if (mGeoTagEnabled && (!mLatitudeTV.getText().equals("Getting latitude...") && !mLongitudeTV.getText().equals("Getting longitude..."))) { find.setLatitude(Double.parseDouble(mLatitudeTV.getText().toString())); find.setLongitude(Double.parseDouble(mLongitudeTV.getText().toString())); } else { find.setLatitude(0); find.setLongitude(0); } } if (mAdhocTV != null) { find.setIs_adhoc(Integer.parseInt((String) mAdhocTV.getText())); } // Set Project ID SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); int projectId = prefs.getInt(getString(R.string.projectPref), 0); find.setProject_id(projectId); // Mark the find unsynced // find.setSynced(Find.NOT_SYNCED); return find; }
From source file:net.ddns.mlsoftlaberge.contactslist.ui.ContactAdminFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // When "edit" menu option selected case R.id.menu_modif_contact: // Standard system edit contact intent Intent intent = new Intent(Intent.ACTION_EDIT, mContactUri); // Because of an issue in Android 4.0 (API level 14), clicking Done or Back in the // People app doesn't return the user to your app; instead, it displays the People // app's contact list. A workaround, introduced in Android 4.0.3 (API level 15) is // to set a special flag in the extended data for the Intent you send to the People // app. The issue is does not appear in versions prior to Android 4.0. You can use // the flag with any version of the People app; if the workaround isn't needed, // the flag is ignored. intent.putExtra("finishActivityOnSaveCompleted", true); // Start the edit activity startActivity(intent);//from www. j a v a 2 s . c o m return true; } return super.onOptionsItemSelected(item); }