List of usage examples for android.app Activity RESULT_CANCELED
int RESULT_CANCELED
To view the source code for android.app Activity RESULT_CANCELED.
Click Source Link
From source file:com.phonegap.plugins.discoverscanar.DiscoverScanAR.java
/** * Called when the barcode scanner intent completes. * * @param requestCode The request code originally supplied to startActivityForResult(), * allowing you to identify who this result came from. * @param resultCode The integer result code returned by the child activity through its setResult(). * @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). *///ww w . ja va2s . c o m @Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { // logging goes to logcat. LOG.d for debug(), LOG.e for error() // http://www.vogella.com/tutorials/AndroidLogging/article.html //Log.d(LOG_TAG, "#### onActivityResult"); if (requestCode == REQUEST_SCAN_CODE) { if (resultCode == Activity.RESULT_OK) { JSONObject obj = new JSONObject(); try { obj.put(TEXT, intent.getStringExtra("SCAN_RESULT")); obj.put(FORMAT, intent.getStringExtra("SCAN_RESULT_FORMAT")); obj.put(CANCELLED, false); this.callbackContext.success(obj); Log.e(LOG_TAG, "#### Found text: " + intent.getStringExtra("SCAN_RESULT") + " AND Called callback on success"); } catch (JSONException e) { Log.d(LOG_TAG, "This should never happen"); this.callbackContext.error("Scan intent. Unexpected error: " + e.getMessage()); } //this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback); //this.callbackContext.success(obj); } else if (resultCode == Activity.RESULT_CANCELED) { JSONObject obj = new JSONObject(); try { obj.put(TEXT, ""); obj.put(FORMAT, ""); obj.put(CANCELLED, true); //Log.e(LOG_TAG, "#### Found no text"); this.callbackContext.success(obj); } catch (JSONException e) { Log.d(LOG_TAG, "This should never happen"); this.callbackContext.error("Scan intent. Unexpected error: " + e.getMessage()); } //this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback); //this.callbackContext.success(obj); } else { //this.error(new PluginResult(PluginResult.Status.ERROR), this.callback); this.callbackContext.error("Scan intent. Unexpected error"); } } else if (requestCode == REQUEST_ARSCAN_CODE) { if (resultCode == Activity.RESULT_OK) { JSONObject obj = new JSONObject(); try { obj.put(TEXT, intent.getStringExtra("ARSCAN_RESULT")); obj.put(CANCELLED, false); this.callbackContext.success(obj); } catch (JSONException e) { Log.d(LOG_TAG, "ARScan intent (RESULT_OK) threw an exception: This should never happen"); this.callbackContext.error("ARScan intent. Unexpected error: " + e.getMessage()); } //this.callbackContext.success(obj); } else if (resultCode == Activity.RESULT_CANCELED) { JSONObject obj = new JSONObject(); try { obj.put(TEXT, ""); obj.put(CANCELLED, true); this.callbackContext.success(obj); } catch (JSONException e) { Log.d(LOG_TAG, "ARScan intent (RESULT_CANCELED) threw an exception. This should never happen"); this.callbackContext.error("ARScan intent. Unexpected error: " + e.getMessage()); } //this.callbackContext.success(obj); } else { //this.error(new PluginResult(PluginResult.Status.ERROR), this.callback); this.callbackContext.error("ARScan intent. Unexpected error"); } } }
From source file:com.globalcollect.gateway.sdk.client.android.exampleapp.fragments.FullWalletConfirmationButtonFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { mProgressDialog.hide();//from w w w . ja v a2 s . co m // retrieve the error code, if available int errorCode = -1; if (data != null) { errorCode = data.getIntExtra(WalletConstants.EXTRA_ERROR_CODE, -1); } switch (requestCode) { case REQUEST_CODE_RESOLVE_LOAD_FULL_WALLET: switch (resultCode) { case Activity.RESULT_OK: if (data != null && data.hasExtra(WalletConstants.EXTRA_FULL_WALLET)) { FullWallet fullWallet = data.getParcelableExtra(WalletConstants.EXTRA_FULL_WALLET); // the full wallet can now be used to process the customer's payment // send the wallet info up to server to process, and to get the result // for sending a transaction status fetchTransactionStatus(fullWallet); } else if (data != null && data.hasExtra(WalletConstants.EXTRA_MASKED_WALLET)) { // re-launch the activity with new masked wallet information mMaskedWallet = data.getParcelableExtra(WalletConstants.EXTRA_MASKED_WALLET); mActivityLaunchIntent.putExtra(Constants.INTENT_MASKED_WALLET, mMaskedWallet); startActivity(mActivityLaunchIntent); } break; case Activity.RESULT_CANCELED: // nothing to do here break; default: handleError(errorCode); break; } break; } }
From source file:com.ovrhere.android.careerstack.ui.fragments.dialogs.ConfirmationDialogFragment.java
@Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss();/*from w w w .j a v a2 s . c o m*/ if (mListener != null && getTargetFragment() == null) { //only if we have a listener and target fragment. mListener.onClick(dialog, which); return; } switch (which) { case DialogInterface.BUTTON_POSITIVE: getTargetFragment().onActivityResult(getTargetRequestCode(), Activity.RESULT_OK, null); break; case DialogInterface.BUTTON_NEGATIVE: getTargetFragment().onActivityResult(getTargetRequestCode(), Activity.RESULT_CANCELED, null); break; } }
From source file:org.liberty.android.fantastischmemo.ui.StudyActivity.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_CANCELED) { return;//from w ww. j a v a 2 s .c o m } switch (requestCode) { case ACTIVITY_FILTER: { Bundle extras = data.getExtras(); filterCategoryId = extras.getInt(EXTRA_CATEGORY_ID); restartActivity(); break; } case ACTIVITY_EDIT: { restartActivity(); break; } case ACTIVITY_GOTO_PREV: { restartActivity(); break; } case ACTIVITY_SETTINGS: { restartActivity(); break; } case ACTIVITY_DETAIL: { restartActivity(); break; } } }
From source file:it.prof.iotsemplicedemo.DeviceScanActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // User chose not to enable Bluetooth. if (requestCode == REQUEST_ENABLE_BT && resultCode == Activity.RESULT_CANCELED) { finish();// w ww . j a v a 2s .c o m return; } super.onActivityResult(requestCode, resultCode, data); }
From source file:org.liberty.android.fantastischmemo.ui.SettingsScreen.java
@Override public void onBackPressed() { if (settingsChanged) { new AlertDialog.Builder(this).setTitle(R.string.warning_text) .setMessage(R.string.edit_dialog_unsave_warning) .setPositiveButton(R.string.yes_text, new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int which) { SaveButtonTask task = new SaveButtonTask(); task.execute((Void) null); }/*from ww w . ja v a 2 s .co m*/ }).setNeutralButton(R.string.no_text, new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int which) { Intent resultIntent = new Intent(); setResult(Activity.RESULT_CANCELED, resultIntent); finish(); } }).setNegativeButton(R.string.cancel_text, null).create().show(); } else { Intent resultIntent = new Intent(); setResult(Activity.RESULT_CANCELED, resultIntent); finish(); } }
From source file:com.deliciousdroid.activity.FragmentBaseActivity.java
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_CANCELED) { finish();/* w w w.j a v a 2s. c o m*/ } }
From source file:com.a3did.partner.recosample.MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_ENABLE_BT && resultCode == Activity.RESULT_CANCELED) { //If the request to turn on bluetooth is denied, the app will be finished. //? ? ? , ?? ?. finish();//w ww . j a v a 2 s. c o m return; } super.onActivityResult(requestCode, resultCode, data); }
From source file:com.uoit.freeroomfinder.MainActivity.java
/** * onLogin The method for handling a login completion. * // w w w . j a v a2 s . c o m * @param requestCode The expected return code for the request. * @param resultCode The result code of the activity. */ public void onLogin(int requestCode, int resultCode) { if (requestCode == LoginActivity.LOGIN_SUCCESSFUL) { if (resultCode == Activity.RESULT_CANCELED) { this.finish(); } } }
From source file:org.klnusbaum.udj.EventListFragment.java
public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case ACCOUNT_CREATION: if (resultCode == Activity.RESULT_OK) { account = (Account) data.getParcelableExtra(Constants.ACCOUNT_EXTRA); } else {//w w w . j av a2 s .com getActivity().setResult(Activity.RESULT_CANCELED); getActivity().finish(); } break; } }