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.narkii.security.info.LicenseInfoFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); Log.d(TAG, "on activity result"); ///*from ww w .ja va 2 s . c om*/ if (requestCode == Constants.CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) { Log.d(TAG, "on activity result camera"); if (resultCode == Activity.RESULT_OK) { //data.getData()NullPointer // Toast.makeText(this, "Image saved to:\n" + // data.getData(), Toast.LENGTH_LONG).show(); ContentResolver cr = getActivity().getContentResolver(); try { preBitmap = BitmapFactory.decodeStream(cr.openInputStream(fileUri)); previewImage.setImageBitmap(preBitmap); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } isImage = true; } else if (resultCode == Activity.RESULT_CANCELED) { Toast.makeText(getActivity(), "cancel camera", Toast.LENGTH_LONG).show(); } else { Toast.makeText(getActivity(), "failed", Toast.LENGTH_LONG).show(); } } // if (requestCode == Constants.CONTENT_GET_ACTIVITY_REQUEST_CODE) { // if (resultCode == Activity.RESULT_OK) { fileUri = data.getData(); String path = fileUri.getPath(); Log.d(TAG, "uri= " + fileUri.getPath()); Log.d(TAG, "uri2= " + fileUri); if (path.contains("/external/images/media")) {// isImage = true; ContentResolver cr = getActivity().getContentResolver(); try { preBitmap = BitmapFactory.decodeStream(cr.openInputStream(fileUri)); previewImage.setImageBitmap(preBitmap); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else {// isImage = false; } } else if (resultCode == Activity.RESULT_CANCELED) { Toast.makeText(getActivity(), "cancel file select", Toast.LENGTH_LONG).show(); } else { Toast.makeText(getActivity(), "failed", Toast.LENGTH_LONG).show(); } } }
From source file:de.schildbach.wallet.ui.ChannelRequestActivity.java
@Override public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case android.R.id.home: disconnectAndFinish(Activity.RESULT_CANCELED); return true; case R.id.send_coins_options_help: HelpDialogFragment.page(getSupportFragmentManager(), "help_open_channel"); return true; }/*from w w w.ja v a 2 s . c o m*/ return super.onOptionsItemSelected(item); }
From source file:de.j4velin.chess.Main.java
@Override public void onActivityResult(int request, int response, final Intent data) { super.onActivityResult(request, response, data); if (BuildConfig.DEBUG) Logger.log("Main onActivityResult"); if (response != Activity.RESULT_OK) { // user canceled return;/*from w w w . j av a 2 s. c o m*/ } if (request == RC_SELECT_PLAYERS) { // get the invitee list final ArrayList<String> invitees = data.getStringArrayListExtra(Games.EXTRA_PLAYER_IDS); // get auto-match criteria Bundle autoMatchCriteria; int minAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MIN_AUTOMATCH_PLAYERS, 0); int maxAutoMatchPlayers = data.getIntExtra(Multiplayer.EXTRA_MAX_AUTOMATCH_PLAYERS, 0); if (minAutoMatchPlayers > 0) { autoMatchCriteria = RoomConfig.createAutoMatchCriteria(minAutoMatchPlayers, maxAutoMatchPlayers, 0); } else { autoMatchCriteria = null; } TurnBasedMatchConfig tbmc = TurnBasedMatchConfig.builder().addInvitedPlayers(invitees) .setAutoMatchCriteria(autoMatchCriteria).setVariant(StartFragment.LAST_SELECTED_MATCH_MODE) .build(); // kick the match off Games.TurnBasedMultiplayer.createMatch(mGoogleApiClient, tbmc) .setResultCallback(new ResultCallback<TurnBasedMultiplayer.InitiateMatchResult>() { @Override public void onResult(final TurnBasedMultiplayer.InitiateMatchResult result) { if (BuildConfig.DEBUG) Logger.log("InitiateMatchResult onResult " + result.getStatus()); // Check if the status code is not success; if (result.getStatus().getStatusCode() != GamesStatusCodes.STATUS_OK) { return; } TurnBasedMatch match = result.getMatch(); if (match.getData() == null) { Game.newGame(match, mGoogleApiClient); } else { if (!Game.load(match.getData(), match, mGoogleApiClient)) { updateApp(); return; } } startGame(match.getMatchId()); } }); } else if (request == RC_RESOLVE) { // We're coming back from an activity that was launched to resolve a // connection problem. For example, the sign-in UI. if (response == Activity.RESULT_OK && !mGoogleApiClient.isConnected() && !mGoogleApiClient.isConnecting()) { // Ready to try to connect again. mGoogleApiClient.connect(); } else if (response == GamesActivityResultCodes.RESULT_RECONNECT_REQUIRED && !mGoogleApiClient.isConnected() && !mGoogleApiClient.isConnecting()) { mGoogleApiClient.connect(); } else if (response == Activity.RESULT_CANCELED) { // User cancelled. mGoogleApiClient.disconnect(); } } }
From source file:com.money.manager.ex.search.SearchParametersFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if ((resultCode == Activity.RESULT_CANCELED) || data == null) return;//from ww w . j a va2 s. co m SearchParameters searchParameters; String stringExtra; switch (requestCode) { case RequestCodes.PAYEE: viewHolder.txtSelectPayee .setTag(data.getIntExtra(PayeeActivity.INTENT_RESULT_PAYEEID, Constants.NOT_SET)); viewHolder.txtSelectPayee.setText(data.getStringExtra(PayeeActivity.INTENT_RESULT_PAYEENAME)); break; case RequestCodes.CATEGORY: //create class for store data CategorySub categorySub = new CategorySub(); categorySub.categId = data.getIntExtra(CategoryListActivity.INTENT_RESULT_CATEGID, Constants.NOT_SET); categorySub.categName = data.getStringExtra(CategoryListActivity.INTENT_RESULT_CATEGNAME); categorySub.subCategId = data.getIntExtra(CategoryListActivity.INTENT_RESULT_SUBCATEGID, Constants.NOT_SET); categorySub.subCategName = data.getStringExtra(CategoryListActivity.INTENT_RESULT_SUBCATEGNAME); //update into button displayCategory(categorySub); break; case RequestCodes.AMOUNT_FROM: stringExtra = data.getStringExtra(CalculatorActivity.RESULT_AMOUNT); searchParameters = getSearchParameters(); searchParameters.amountFrom = MoneyFactory.fromString(stringExtra); setSearchParameters(searchParameters); displayAmountFrom(); break; case RequestCodes.AMOUNT_TO: stringExtra = data.getStringExtra(CalculatorActivity.RESULT_AMOUNT); searchParameters = getSearchParameters(); searchParameters.amountTo = MoneyFactory.fromString(stringExtra); setSearchParameters(searchParameters); displayAmountTo(); break; } }
From source file:com.brq.wallet.activity.ScanActivity.java
@Override public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) { if (Activity.RESULT_CANCELED == resultCode) { finishError(R.string.cancelled, ""); return;//from ww w . j a v a 2 s . com } //since it was not the handler, it can only be the scanner Preconditions.checkState(SCANNER_RESULT_CODE == requestCode); // If the last autofocus setting got saved in an extra-field, change the app settings accordingly int autoFocus = intent.getIntExtra("ENABLE_CONTINUOUS_FOCUS", -1); if (autoFocus != -1) { MbwManager.getInstance(this).setContinuousFocus(autoFocus == 1); } if (!isQRCode(intent)) { finishError(R.string.unrecognized_format, ""); return; } String content = intent.getStringExtra("SCAN_RESULT").trim(); // Get rid of any UTF-8 BOM marker. Those should not be present, but might have slipped in nonetheless, if (content.length() != 0 && content.charAt(0) == '\uFEFF') content = content.substring(1); // Call the stringHandler activity and pass its result to our caller Intent handlerIntent = StringHandlerActivity.getIntent(this, _stringHandleConfig, content); handlerIntent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); this.startActivity(handlerIntent); // we are done here... this.finish(); }
From source file:com.jalotsav.apppermissionruntime.MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case REQUEST_CHECK_SETTINGS: switch (resultCode) { case Activity.RESULT_OK: startLocationUpdates();//from ww w. jav a2s . c om break; case Activity.RESULT_CANCELED: locationEnableSettingsRequest();//keep asking if imp or do whatever break; } break; } }
From source file:com.sck.maininterface.PaymentInfo.java
@SuppressWarnings("deprecation") @Override/*ww w .ja v a2 s. c o m*/ protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_PAYMENT) { if (resultCode == Activity.RESULT_OK) { PaymentConfirmation confirm = data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION); if (confirm != null) { try { Log.i(TAG, confirm.toJSONObject().toString(4)); Log.i(TAG, confirm.getPayment().toJSONObject().toString(4)); /* Toast.makeText( getApplicationContext(), "Payment Confirmation info received from PayPal", Toast.LENGTH_LONG).show();*/ AlertDialog ad = new AlertDialog.Builder(this).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("Payment Confirmation info received from PayPal"); ad.setButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); ad.show(); //new updateExpiryDate().execute(); //paymentSuccess=true; saveExpDate(renewedDate); } catch (JSONException e) { Log.e(TAG, "an extremely unlikely failure occurred: ", e); } } } else if (resultCode == Activity.RESULT_CANCELED) { Log.i(TAG, "The user canceled."); } else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) { Log.i(TAG, "An invalid Payment or PayPalConfiguration was submitted. Please see the docs."); } } // / }
From source file:org.gnucash.android.ui.accounts.AccountsListFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_CANCELED) return;//from w w w .j ava2s .c o m refreshList(); }
From source file:com.snipme.record.Record.java
/** * Called when the video view exits./*from ww w .ja v a 2 s . c om*/ * * @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"). * @throws JSONException */ public void onActivityResult(int requestCode, int resultCode, final Intent intent) { if (resultCode == Activity.RESULT_OK) { if (requestCode == CAPTURE_VIDEO) { Log.i(TAG, "onActivityResult: Video Capture success"); final Record that = this; Runnable captureVideo = new Runnable() { @Override public void run() { Uri data = null; if (intent != null) { // Get the uri of the video clip data = intent.getData(); Log.i(TAG, "onActivityResult: Uri: " + data); Log.i(TAG, "Uri of the video file recorded"); } if (data == null) { File movie = new File(getTempDirectoryPath(), "Capture.avi"); data = Uri.fromFile(movie); } // create a file object from the uri if (data == null) { that.fail(createErrorObject(CAPTURE_NO_MEDIA_FILES, "Error: data is null")); } else { results.put(createMediaFile(data)); if (results.length() >= 1) { // Send Uri back to JavaScript for viewing video that.callbackContext .sendPluginResult(new PluginResult(PluginResult.Status.OK, results)); } else { // still need to capture more video clips //captureVideo(duration); } } } }; this.cordova.getThreadPool().execute(captureVideo); } } else if (resultCode == Activity.RESULT_CANCELED) { } }
From source file:net.wespot.pim.view.InqDataCollectionFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case DIALOG_FRAGMENT: if (resultCode == Activity.RESULT_OK) { // After Ok code. Log.i(TAG, "ok code"); INQ.dataCollection.createDataCollectionTask( INQ.inquiry.getCurrentInquiry().getRunLocalObject().getGameLocalObject().getId(), dialog.getTitle(), dialog.getDescription(), dialog.isImage(), dialog.isAudio(), dialog.isText(), dialog.isVideo(), dialog.isNumber()); Toast.makeText(getActivity(), getResources().getString(R.string.data_collection_dialog_creating), Toast.LENGTH_SHORT).show(); } else if (resultCode == Activity.RESULT_CANCELED) { // After Cancel code. Log.i(TAG, "cancel code"); }//from w w w . java2s.c o m break; } }