List of usage examples for android.content Intent getSerializableExtra
public Serializable getSerializableExtra(String name)
From source file:de.grobox.liberario.activities.MapActivity.java
private void setupMap() { MapEventsOverlay mapEventsOverlay = new MapEventsOverlay(this); map.getOverlays().add(0, mapEventsOverlay); Intent intent = getIntent(); if (intent != null) { String action = intent.getAction(); if (action != null) { //noinspection IfCanBeSwitch if (action.equals(SHOW_AREA)) { showArea();/*from www. j av a 2 s . c o m*/ } else if (action.equals(SHOW_LOCATIONS)) { @SuppressWarnings("unchecked") List<Location> locations = (ArrayList<Location>) intent.getSerializableExtra(LOCATIONS); Location myLoc = (Location) intent.getSerializableExtra(LOCATION); showLocations(locations, myLoc); } else if (action.equals(SHOW_TRIP)) { Trip trip = (Trip) intent.getSerializableExtra(TRIP); showTrip(trip); } } } map.getOverlays().add(gpsController.getOverlay()); setViewSpan(); }
From source file:org.kontalk.ui.NumberValidation.java
@Override @SuppressWarnings("unchecked") protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_MANUAL_VALIDATION) { if (resultCode == RESULT_OK) { Map<String, Keyring.TrustedFingerprint> trustedKeys = null; Map<String, String> keys = (HashMap) data.getSerializableExtra(PARAM_TRUSTED_KEYS); if (keys != null) { trustedKeys = Keyring.fromTrustedFingerprintMap(keys); }/*from www . j a v a 2 s . c om*/ finishLogin(data.getStringExtra(PARAM_SERVER_URI), data.getStringExtra(PARAM_CHALLENGE), data.getByteArrayExtra(PARAM_PRIVATEKEY), data.getByteArrayExtra(PARAM_PUBLICKEY), true, trustedKeys); } else if (resultCode == RESULT_FALLBACK) { mClearState = true; startValidation(data.getBooleanExtra("force", false), true); } } }
From source file:com.xunlei.shortvideo.activity.VideoPublishLocal3Activity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE_VIDEO_COVER && resultCode == RESULT_OK && data != null) { VideoSliceConfig config = (VideoSliceConfig) data .getSerializableExtra(VideoSliceConfig.VIDEO_SLICE_CONFIG); // setThumb(config.getPath(), config.getIndex(), config.getTotal()); mConfig.setIndex(config.getIndex()); mConfig.setTotal(config.getTotal()); mConfig.setCoverOffset(config.getTime()); mConfig.setUseCover(true);// w w w.j a v a 2 s . co m } if (requestCode == REQUEST_CODE_VIDEO_PERMISSION && resultCode == RESULT_OK && data != null) { mMiscConfig = (VideoMiscConfig) data.getSerializableExtra(VideoMiscConfig.VIDEO_MISC_CONFIG); } if (requestCode == RenderRequest.RENDER_MODE_EXPORT_VIDEO && resultCode == RESULT_OK && data != null) { long duration = data.getLongExtra("duration", 0); String path = data.getStringExtra("path"); File file = new File(path); loadExportedVideo(duration, file.getAbsolutePath()); } }
From source file:com.brq.wallet.external.cashila.activity.CashilaPaymentsActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_SEND_AMOUNT) { // switch to the list tab setCurrentPage(1);/* ww w.ja va 2 s .c o m*/ // reload list immediately ... updatePayments(); if (resultCode == RESULT_OK) { // ... and also schedule a reload of the pending list in some seconds // because the cashila backend takes some time to register the payment new Handler().postDelayed(new Runnable() { @Override public void run() { CashilaPendingFragment pendingFragment = getPendingFragment(); // ensure that the fragment is still alive if (pendingFragment != null && pendingFragment.isAdded()) { pendingFragment.refresh(false); } } }, 5000); } } else if (requestCode == REQUEST_ADD_RECIPIENT) { if (resultCode == RESULT_OK) { UUID recipientId = (UUID) data.getSerializableExtra(CashilaAddRecipientActivity.RECIPIENT_ID); getNewFragment().selectRecipient(recipientId, false); } } else { super.onActivityResult(requestCode, resultCode, data); } }
From source file:it.evilsocket.dsploit.core.UpdateService.java
@Override protected void onHandleIntent(Intent intent) { action what_to_do = (action) intent.getSerializableExtra(ACTION); boolean exitForError = true; if (what_to_do == null) { Logger.error("received null action"); return;//from ww w . j av a2s . c o m } mRunning = true; switch (what_to_do) { case apk_update: mCurrentTask = mApkInfo; break; case ruby_update: mCurrentTask = mRubyInfo; break; case msf_update: mCurrentTask = mMsfInfo; break; case gems_update: mCurrentTask = new ArchiveMetadata(); break; } try { setupNotification(); synchronized (mCurrentTask) { if (!haveLocalFile()) downloadFile(); extract(); correctModes(); patchShebang(); if (what_to_do == action.ruby_update) updateRubyGems(); else if (what_to_do == action.msf_update) installGems(); else if (what_to_do == action.gems_update) updateGems(); if (what_to_do != action.apk_update) deleteTemporaryFiles(); } exitForError = false; if (what_to_do == action.msf_update) System.updateLocalMsfVersion(); if (what_to_do == action.ruby_update) System.updateLocalRubyVersion(); sendDone(what_to_do); } catch (SecurityException e) { sendError(R.string.bad_permissions); Logger.warning(e.getClass().getName() + ": " + e.getMessage()); } catch (KeyException e) { sendError(R.string.checksum_failed); Logger.warning(e.getClass().getName() + ": " + e.getMessage()); } catch (NoSuchAlgorithmException e) { sendError(R.string.error_occured); System.errorLogging(e); } catch (CancellationException e) { Logger.warning(e.getClass().getName() + ": " + e.getMessage()); } catch (IOException e) { sendError(R.string.error_occured); System.errorLogging(e); } catch (RuntimeException e) { sendError(R.string.error_occured); if (e.getClass() == NullPointerException.class) System.errorLogging(e); else Logger.error(e.getClass().getName() + ": " + e.getMessage()); } catch (InterruptedException e) { sendError(R.string.error_occured); System.errorLogging(e); } finally { if (exitForError) { clearGemsCache(); wipe(); } stopSelf(); mRunning = false; } }
From source file:com.brq.wallet.activity.modern.AccountsFragment.java
@Override public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) { ActivityCompat.invalidateOptionsMenu(getActivity()); if (requestCode == ADD_RECORD_RESULT_CODE && resultCode == AddCoinapultAccountActivity.RESULT_COINAPULT) { UUID accountId = (UUID) intent.getSerializableExtra(AddAccountActivity.RESULT_KEY); CoinapultAccount account = (CoinapultAccount) _mbwManager.getWalletManager(false).getAccount(accountId); _mbwManager.setSelectedAccount(accountId); _focusedAccount = account;/*w w w.ja va 2 s .c om*/ update(); return; } if (requestCode == ADD_RECORD_RESULT_CODE && resultCode == Activity.RESULT_OK) { UUID accountid = (UUID) intent.getSerializableExtra(AddAccountActivity.RESULT_KEY); //check whether the account is active - we might have scanned the priv key for an archived watchonly WalletAccount account = _mbwManager.getWalletManager(false).getAccount(accountid); if (account.isActive()) { _mbwManager.setSelectedAccount(accountid); } _focusedAccount = account; update(); setNameForNewAccount(_focusedAccount); } else { super.onActivityResult(requestCode, resultCode, intent); } }
From source file:com.chatwing.whitelabel.activities.LegacyLoginActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE_SIGN_IN_GOOGLE_PLUS || requestCode == REQUEST_CODE_GET_GOOGLE_PLAY_SERVICES) { // Google+ resolve error if (resultCode == Activity.RESULT_OK && !mGoogleApiClient.isConnected() && !mGoogleApiClient.isConnecting()) { mConnectionResult = null;// www . j a va2s . c om connectPlusClient(); } else { mProgressViewsManager.showProgress(false); } } else if (requestCode == REQUEST_CODE_USER_RECOVERABLE_AUTH) { if (resultCode == RESULT_OK) { connectPlusClient(); } else { mProgressViewsManager.showProgress(false); } } else if (requestCode == REQUEST_CODE_AUTHENTICATE && resultCode == RESULT_OK) { checkUser((User) data.getSerializableExtra(AuthenticateActivity.INTENT_USER)); } }
From source file:tw.com.geminihsu.app01.fragment.Fragment_PickUpAirPlane.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case Constants.DEPARTURE_QUERY_GPS: ArrayList<Address> locationInfo = null; if (data != null) { //departure_detail = new LocationAddress(); departure_detail = (LocationAddress) data.getSerializableExtra(Constants.BUNDLE_LOCATION); //String add_bookmark = data.getStringExtra(BUNDLE_KEEP_BOOMARK); //String latitude = data.getStringExtra(Constants.BUNDLE_MAP_LATITUDE); //String longitude = data.getStringExtra(Constants.BUNDLE_MAP_LONGITUDE); //departure_detail.setLatitude(location.getLatitude()); //departure_detail.setLongitude(location.getLongitude()); boolean isBookMark = data.getBooleanExtra(BUNDLE_KEEP_BOOMARK, false); if (isBookMark) { addUserLocationToBookMark(departure_detail); }//from w ww . j av a 2s. c om departure_address.setText(departure_detail.getAddress()); //departure_detail.setLocation(location.getAddress()); //departure_detail.setAddress(location.getAddress()); /*if(add_bookmark.equals(true)) { //BookMark }*/ //showAddressList((ArrayList<Address>)locationInfo,departure_address,departure_detail); } break; case Constants.STOP_QUERY_GPS: //ArrayList<Address> locationInfo=null; if (data != null) { //departure_detail = new LocationAddress(); departure_detail = (LocationAddress) data.getSerializableExtra(Constants.BUNDLE_LOCATION); //String add_bookmark = data.getStringExtra(BUNDLE_KEEP_BOOMARK); //String latitude = data.getStringExtra(Constants.BUNDLE_MAP_LATITUDE); //String longitude = data.getStringExtra(Constants.BUNDLE_MAP_LONGITUDE); //departure_detail.setLatitude(location.getLatitude()); //departure_detail.setLongitude(location.getLongitude()); boolean isBookMark = data.getBooleanExtra(BUNDLE_KEEP_BOOMARK, false); if (isBookMark) { addUserLocationToBookMark(stop_detail); } stop_address.setText(stop_detail.getAddress()); //departure_detail.setLocation(location.getAddress()); //departure_detail.setAddress(location.getAddress()); /*if(add_bookmark.equals(true)) { //BookMark }*/ //showAddressList((ArrayList<Address>)locationInfo,departure_address,departure_detail); } break; case Constants.DESTINATION_QUERY_GPS: ArrayList<Address> locationInfo2 = null; if (data != null) { //destination_detail = new LocationAddress(); destination_detail = (LocationAddress) data.getSerializableExtra(Constants.BUNDLE_LOCATION); //String latitude = data.getStringExtra(Constants.BUNDLE_MAP_LATITUDE); //String longitude = data.getStringExtra(Constants.BUNDLE_MAP_LONGITUDE); //destination_detail.setLatitude(Double.valueOf(latitude)); //destination_detail.setLongitude(Double.valueOf(longitude)); boolean isBookMark = data.getBooleanExtra(BUNDLE_KEEP_BOOMARK, false); if (isBookMark) { addUserLocationToBookMark(destination_detail); } destination_address.setText(destination_detail.getAddress()); //destination_detail.setAddress(locationInfo2.get(0).getAddressLine(0)); //destination_detail.setLocation(locationInfo2.get(0).getAddressLine(0)); //showAddressList(locationInfo2,destination_address,destination_detail); } break; case Constants.DEPARTURE_QUERY_BOOKMARK: if (data != null) { departure_detail = new LocationAddress(); USerBookmark uSerBookmark = (USerBookmark) data.getSerializableExtra(Constants.BUNDLE_LOCATION); departure_address.setText(uSerBookmark.getStreetAddress()); departure_detail.setLongitude(Double.parseDouble(uSerBookmark.getLng())); departure_detail.setLatitude(Double.parseDouble(uSerBookmark.getLat())); departure_detail.setAddress(uSerBookmark.getStreetAddress()); departure_detail.setLocation(uSerBookmark.getLocation()); departure_detail.setCountryName(uSerBookmark.getCountryName()); departure_detail.setLocality(uSerBookmark.getLocality()); departure_detail.setZipCode(uSerBookmark.getZipCode()); } break; case Constants.STOP_QUERY_BOOKMARK: if (data != null) { stop_detail = new LocationAddress(); USerBookmark uSerBookmark = (USerBookmark) data.getSerializableExtra(Constants.BUNDLE_LOCATION); stop_address.setText(uSerBookmark.getStreetAddress()); stop_detail.setLongitude(Double.parseDouble(uSerBookmark.getLng())); stop_detail.setLatitude(Double.parseDouble(uSerBookmark.getLat())); stop_detail.setAddress(uSerBookmark.getStreetAddress()); stop_detail.setLocation(uSerBookmark.getLocation()); stop_detail.setCountryName(uSerBookmark.getCountryName()); stop_detail.setLocality(uSerBookmark.getLocality()); stop_detail.setZipCode(uSerBookmark.getZipCode()); } break; case Constants.DESTINATION_QUERY_BOOKMARK: if (data != null) { destination_detail = new LocationAddress(); USerBookmark uSerBookmark1 = (USerBookmark) data.getSerializableExtra(Constants.BUNDLE_LOCATION); destination_address.setText(uSerBookmark1.getStreetAddress()); destination_detail.setLongitude(Double.parseDouble(uSerBookmark1.getLng())); destination_detail.setLatitude(Double.parseDouble(uSerBookmark1.getLat())); destination_detail.setAddress(uSerBookmark1.getStreetAddress()); destination_detail.setLocation(uSerBookmark1.getLocation()); destination_detail.setCountryName(uSerBookmark1.getCountryName()); destination_detail.setLocality(uSerBookmark1.getLocality()); destination_detail.setZipCode(uSerBookmark1.getZipCode()); } break; } }
From source file:eu.e43.impeller.activity.MainActivity.java
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); m_pendingIntent = false;//from w ww . j a va 2 s . c o m Log.i(TAG, "New intent " + intent); if (intent.hasExtra(Constants.EXTRA_ACCOUNT)) { haveGotAccount((Account) intent.getParcelableExtra(Constants.EXTRA_ACCOUNT)); } if (m_account == null) { setIntent(intent); m_pendingIntent = true; return; } String action = intent.getAction(); if (Intent.ACTION_VIEW.equals(action)) { Uri uri = intent.getData(); if (uri == null) return; Uri id = null; if (uri.getScheme().equals("content") && uri.getHost().equals("eu.e43.impeller.content")) { id = Uri.parse(uri.getLastPathSegment()); } else { id = uri; } setIntent(intent); showObjectInMode(Mode.OBJECT, id); } else if (Constants.ACTION_SHOW_FEED.equals(action)) { showFeed((Constants.FeedID) intent.getSerializableExtra(Constants.EXTRA_FEED_ID)); } else { Log.d(TAG, "Unknown new intent " + intent); } }
From source file:ru.tinkoff.acquiring.sdk.EnterCardFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); sdk = ((PayFormActivity) getActivity()).getSdk(); final Intent intent = getActivity().getIntent(); final String email = intent.getStringExtra(PayFormActivity.EXTRA_E_MAIL); if (email != null && etEmail != null) { etEmail.setText(email);// w ww .j a va 2s . c o m } final String title = intent.getStringExtra(PayFormActivity.EXTRA_TITLE); if (tvTitle != null) { tvTitle.setText(title); } String description = intent.getStringExtra(PayFormActivity.EXTRA_DESCRIPTION); if (tvDescription != null) { tvDescription.setText(description); } final Money amount = (Money) intent.getSerializableExtra(PayFormActivity.EXTRA_AMOUNT); String amountTextWithRubbles = amount != null ? amount.toHumanReadableString() : ""; String amountText = amount != null ? amount.toString() : ""; if (amountPositionMode == AMOUNT_POSITION_OVER_FIELDS && tvAmount != null) { if (TextUtils.isEmpty(moneyAmountFormat)) { tvAmount.setText(amountTextWithRubbles); } else { tvAmount.setText(String.format(moneyAmountFormat, amountText)); } } else if (TextUtils.isEmpty(payAmountFormat)) { String text = btnPay.getText().toString(); btnPay.setText(text + " " + amountTextWithRubbles); } else { btnPay.setText(String.format(payAmountFormat, amountText)); } btnPay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (customKeyboard != null) { customKeyboard.hide(); } final String enteredEmail = getEmail(); if (!validateInput(ecvCard, enteredEmail)) { return; } final PayFormActivity activity = (PayFormActivity) getActivity(); final CardData cardData = getCardData(activity); activity.showProgressDialog(); InitRequestBuilder requestBuilder = createInitRequestBuilder(intent); initPayment(sdk, requestBuilder, cardData, null, enteredEmail, chargeMode); } }); if (btnGooglePay != null) { btnGooglePay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { PaymentDataRequest request = createPaymentDataRequest(); if (request != null) { AutoResolveHelper.resolveTask(paymentsClient.loadPaymentData(request), getActivity(), LOAD_PAYMENT_DATA_REQUEST_CODE); } } }); } if (rejectAction != null) { rejectAction.onPerformReject(); } }