List of usage examples for android.content Intent getParcelableExtra
public <T extends Parcelable> T getParcelableExtra(String name)
From source file:com.microsoft.mimickeralarm.settings.RingtonePreference.java
public void handleRingtonePickerResult(Intent data) { if (data != null) { Uri ringtone = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); if (ringtone == null) { if (getRingtone() != null) { setRingtone(null);//from w ww. j a v a 2 s. c om setChanged(true); } } else if (getRingtone() == null || getRingtone().toString().compareToIgnoreCase(ringtone.toString()) != 0) { setRingtone(ringtone); setChanged(true); } } }
From source file:net.primeranks.fs_viewer.fs_replay.ConnectionChangedBroadcastReceiver.java
public void onReceive(Context context, Intent intent) { String info = intent.getStringExtra(ConnectivityManager.EXTRA_EXTRA_INFO); NetworkInfo nwInfo = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); Log.d(Config.LOG_AS, info + ": " + nwInfo.getReason()); HttpParams httpParams = EntryPointActivity.getHttpClient().getParams(); if (nwInfo.getType() == ConnectivityManager.TYPE_MOBILE) { String proxyHost = Proxy.getHost(context); if (proxyHost == null) { proxyHost = Proxy.getDefaultHost(); }//from ww w. j ava2s .c om int proxyPort = Proxy.getPort(context); if (proxyPort == -1) { proxyPort = Proxy.getDefaultPort(); } if (proxyHost != null && proxyPort > -1) { HttpHost proxy = new HttpHost(proxyHost, proxyPort); httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); } else { httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, null); } } else { httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, null); } }
From source file:com.codebutler.farebot.activities.AddKeyActivity.java
@Override protected void onNewIntent(Intent intent) { Tag tag = (Tag) intent.getParcelableExtra("android.nfc.extra.TAG"); mTagId = Utils.getHexString(tag.getId(), ""); if (ArrayUtils.contains(tag.getTechList(), "android.nfc.tech.MifareClassic")) { mCardType = "MifareClassic"; ((TextView) findViewById(R.id.card_type)).setText("MIFARE Classic"); ((TextView) findViewById(R.id.card_id)).setText(mTagId); ((TextView) findViewById(R.id.key_data)).setText(Utils.getHexString(mKeyData, "").toUpperCase()); findViewById(R.id.directions).setVisibility(View.GONE); findViewById(R.id.info).setVisibility(View.VISIBLE); findViewById(R.id.add).setVisibility(View.VISIBLE); } else {/* ww w . j a va 2s . co m*/ new AlertDialog.Builder(this).setMessage(R.string.card_keys_not_supported) .setPositiveButton(android.R.string.ok, null).show(); } }
From source file:com.scvngr.levelup.core.service.AbstractNetworkRequestService.java
/** * Get the request to send with this service. Default implementation gets the request from the * intent (stored in key {@link #EXTRA_PARCELABLE_REQUEST}). Subclasses can override this to * build a request differently./* w ww . ja v a 2s. c o m*/ * * @param intent the intent used to start the service. * @return {@link AbstractRequest} to send with the service. */ @Nullable protected AbstractRequest getRequest(@NonNull final Intent intent) { return intent.getParcelableExtra(EXTRA_PARCELABLE_REQUEST); }
From source file:edu.mit.media.funf.probe.Probe.java
private static Map<PendingIntent, Intent> getCallbacksToRequests(ArrayList<Intent> requests) { Map<PendingIntent, Intent> existingCallbacksToRequests = new HashMap<PendingIntent, Intent>(); for (Intent existingRequest : requests) { PendingIntent callback = existingRequest.getParcelableExtra(CALLBACK_KEY); existingCallbacksToRequests.put(callback, existingRequest); }/*from w w w . j a va 2 s .c o m*/ return existingCallbacksToRequests; }
From source file:eu.andlabs.gcp.GCPService.java
@Override public IBinder onBind(Intent intent) { log("on bind"); mChatGame = (Messenger) intent.getParcelableExtra("messenger"); return mMessenger.getBinder(); }
From source file:com.ibm.cloud.appid.android.internal.authorizationmanager.ChromeTabActivity.java
private void onBroadcastReceived(Intent intent) { Uri uri = intent.getParcelableExtra(ChromeTabActivity.EXTRA_REDIRECT_URI); String url = uri.toString();/*from w ww.j av a 2 s . c o m*/ String code = uri.getQueryParameter("code"); String error = uri.getQueryParameter("error"); String flow = uri.getQueryParameter("flow"); logger.info("onBroadcastReceived: " + url); Intent clearTopActivityIntent = new Intent(postAuthorizationIntent); clearTopActivityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); if (url.startsWith(redirectUrl) && code != null) { logger.debug("Grant code received from authorization server."); oAuthManager.getTokenManager().obtainTokensAuthCode(code, authorizationListener); startActivity(clearTopActivityIntent); } else if (url.startsWith(redirectUrl) && error != null) { if (error.equals("invalid_client")) { oAuthManager.getRegistrationManager().clearRegistrationData(); oAuthManager.getAuthorizationManager().launchAuthorizationUI(this, authorizationListener); } else { String errorCode = uri.getQueryParameter("error_code"); String errorDescription = uri.getQueryParameter("error_description"); logger.error("Failed to obtain access and identity tokens, error: " + error); logger.error("errorCode: " + errorCode); logger.error("errorDescription: " + errorDescription); authorizationListener.onAuthorizationFailure(new AuthorizationException(error)); startActivity(clearTopActivityIntent); } } else if (url.startsWith(redirectUrl) && (FORGOT_PASSWORD.equals(flow) || SIGN_UP.equals(flow))) { logger.debug("onBroadcastReceived: end of flow: " + flow); authorizationListener.onAuthorizationSuccess(null, null, null); startActivity(clearTopActivityIntent); } else { logger.debug("onBroadcastReceived: no match case"); authorizationListener.onAuthorizationFailure(new AuthorizationException("Bad callback uri")); startActivity(clearTopActivityIntent); } }
From source file:anakiou.com.picontrol.service.InputIntentService.java
@Override protected void onHandleIntent(Intent intent) { receiver = intent.getParcelableExtra(Constants.RECEIVER); if (!networkService.isNetworkAvailableAndConnected()) { deliverResultToReceiver(Constants.FAILURE_RESULT, getString(R.string.network_required_msg)); return;/* w ww .ja va2s .c o m*/ } int operationType = intent.getIntExtra(Constants.EXTRA_OPERATION_TYPE, 0); switch (operationType) { case Constants.OP_INPUT_GET: handleGet(); break; case Constants.OP_INPUT_STATUS_ALL_GET: handleStatusAllGet(); break; case Constants.OP_INPUT_NAME_SET: handleNameSet(intent); break; } }
From source file:com.anysoftkeyboard.ui.SendBugReportUiActivity.java
@Override protected void onStart() { super.onStart(); TextView crashTypeView = (TextView) findViewById(R.id.ime_crash_type); Intent callingIntent = getIntent(); mCrashReportDetails = callingIntent.getParcelableExtra(EXTRA_KEY_BugReportDetails); if (mCrashReportDetails == null) { if (BuildConfig.DEBUG) throw new IllegalArgumentException( "Activity started without " + EXTRA_KEY_BugReportDetails + " extra!"); finish();/*w w w . j ava 2 s .c o m*/ } else { if (mCrashReportDetails.throwable == null || (!BuildConfig.DEBUG)) { /*not showing the type of crash in RELEASE mode*/ crashTypeView.setVisibility(View.GONE); } else { Throwable throwable = mCrashReportDetails.throwable; String typeText = throwable.getClass().getName(); if (!TextUtils.isEmpty(throwable.getMessage())) typeText += ": " + throwable.getMessage(); StackTraceElement[] stackTrace = throwable.getStackTrace(); if (stackTrace != null && stackTrace.length > 0) { typeText += "\n"; typeText += "Thrown at " + stackTrace[0].toString(); for (int i = 1; i < Math.min(3, stackTrace.length); i++) { typeText += "\n" + stackTrace[i].toString(); } } crashTypeView.setText(typeText); } } }
From source file:com.codebutler.farebot.activity.AddKeyActivity.java
@Override protected void onNewIntent(Intent intent) { Tag tag = intent.getParcelableExtra("android.nfc.extra.TAG"); mTagId = Utils.getHexString(tag.getId(), ""); if (ArrayUtils.contains(tag.getTechList(), "android.nfc.tech.MifareClassic")) { mCardType = "MifareClassic"; ((TextView) findViewById(R.id.card_type)).setText("MIFARE Classic"); ((TextView) findViewById(R.id.card_id)).setText(mTagId); ((TextView) findViewById(R.id.key_data)).setText(Utils.getHexString(mKeyData, "").toUpperCase()); findViewById(R.id.directions).setVisibility(View.GONE); findViewById(R.id.info).setVisibility(View.VISIBLE); findViewById(R.id.add).setVisibility(View.VISIBLE); } else {/*from w ww.j av a2 s .c o m*/ new AlertDialog.Builder(this).setMessage(R.string.card_keys_not_supported) .setPositiveButton(android.R.string.ok, null).show(); } }