List of usage examples for android.content Intent getParcelableExtra
public <T extends Parcelable> T getParcelableExtra(String name)
From source file:org.klnusbaum.udj.network.PlayerCommService.java
@Override public void onHandleIntent(Intent intent) { Log.d(TAG, "In Player Comm Service"); AccountManager am = AccountManager.get(this); final Account account = (Account) intent.getParcelableExtra(Constants.ACCOUNT_EXTRA); if (intent.getAction().equals(Intent.ACTION_INSERT)) { joinPlayer(intent, am, account, true); } else {//from w w w .ja va2 s .c o m Log.d(TAG, "Unrecognized action of, it was " + intent.getAction()); } }
From source file:com.nestapi.lib.UserAuthActivity.java
private ClientMetadata getClientMetadata() { final Intent intent = getIntent(); return intent == null ? null : (ClientMetadata) intent.getParcelableExtra(CLIENT_METADATA_KEY); }
From source file:com.doctoror.fuckoffmusicplayer.presentation.playback.PlaybackAndroidService.java
private void onActionMediaButton(@NonNull final Intent intent) { final KeyEvent keyEvent = intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT); if (keyEvent != null && keyEvent.getAction() == KeyEvent.ACTION_DOWN) { switch (keyEvent.getKeyCode()) { case KeyEvent.KEYCODE_MEDIA_PLAY: onActionPlayPause();//from ww w .ja v a 2s . c o m break; case KeyEvent.KEYCODE_MEDIA_PAUSE: onActionPause(); break; case KeyEvent.KEYCODE_MEDIA_NEXT: onActionNext(); break; case KeyEvent.KEYCODE_MEDIA_PREVIOUS: onActionPrev(); break; case KeyEvent.KEYCODE_MEDIA_STOP: onActionStop(); break; case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: onActionPlayPause(); break; } } }
From source file:com.example.samples.mp3player.Mp3PlayerService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.i(TAG, "Received start id " + startId + ": " + intent); LocalAudioParcelable media = intent.getParcelableExtra(MEDIA); playAudio(media);// w w w .j a va 2 s. co m // playAudio(intent.getIntExtra(MEDIA, MEDIA_TYPE_DEFAULT), // intent.getStringExtra(PATH)); // We want this service to continue running until it is explicitly // stopped, so return sticky. return START_STICKY; }
From source file:com.android.mail.browse.EmlViewerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.eml_viewer_activity); final ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); final Intent intent = getIntent(); final String action = intent.getAction(); final String type = intent.getType(); mAccountUri = intent.getParcelableExtra(EXTRA_ACCOUNT_URI); if (savedInstanceState == null) { if (Intent.ACTION_VIEW.equals(action) && MimeType.isEmlMimeType(type)) { final FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.add(R.id.eml_root, EmlMessageViewFragment.newInstance(intent.getData(), mAccountUri), FRAGMENT_TAG);//from w ww. j av a2 s. com transaction.commit(); } else { LogUtils.wtf(LOG_TAG, "Entered EmlViewerActivity with wrong intent action or type: %s, %s", action, type); finish(); // we should not be here. bail out. bail out. return; } } else { if (savedInstanceState.containsKey(SAVED_ACCOUNT)) { mAccount = savedInstanceState.getParcelable(SAVED_ACCOUNT); } } // Account uri will be null if we launched from outside of the app. // So just don't load an account at all. if (mAccountUri != null) { getLoaderManager().initLoader(ACCOUNT_LOADER, Bundle.EMPTY, mAccountLoadCallbacks); } }
From source file:com.cerema.cloud2.ui.activity.ErrorsWhileCopyingHandlerActivity.java
/** * {@link}// w ww . j a v a 2 s . c om */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /// read extra parameters in intent Intent intent = getIntent(); mAccount = intent.getParcelableExtra(EXTRA_ACCOUNT); mRemotePaths = intent.getStringArrayListExtra(EXTRA_REMOTE_PATHS); mLocalPaths = intent.getStringArrayListExtra(EXTRA_LOCAL_PATHS); mStorageManager = new FileDataStorageManager(mAccount, getContentResolver()); mHandler = new Handler(); if (mCurrentDialog != null) { mCurrentDialog.dismiss(); mCurrentDialog = null; } /// load generic layout setContentView(R.layout.generic_explanation); /// customize text message TextView textView = (TextView) findViewById(R.id.message); String appName = getString(R.string.app_name); String message = String.format(getString(R.string.sync_foreign_files_forgotten_explanation), appName, appName, appName, appName, mAccount.name); textView.setText(message); textView.setMovementMethod(new ScrollingMovementMethod()); /// load the list of local and remote files that failed ListView listView = (ListView) findViewById(R.id.list); if (mLocalPaths != null && mLocalPaths.size() > 0) { mAdapter = new ErrorsWhileCopyingListAdapter(); listView.setAdapter(mAdapter); } else { listView.setVisibility(View.GONE); mAdapter = null; } /// customize buttons Button cancelBtn = (Button) findViewById(R.id.cancel); Button okBtn = (Button) findViewById(R.id.ok); okBtn.setText(R.string.foreign_files_move); cancelBtn.setOnClickListener(this); okBtn.setOnClickListener(this); }
From source file:es.udc.robotcontrol.testapp.comunication.ConectorPlaca.java
@Override public void conectar(Context ctx, Intent intent) throws TransmisionErrorException { Log.i(Constantes.TAG_CONECTOR, "Conectando a [ " + intent.getAction() + " ]. modo - Host"); device = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE); Log.i(Constantes.TAG_CONECTOR, "Conectando a [ " + device.getDeviceName() + " ]. modo - Host"); /* Get the USB manager from the requesting context */ this.manager = (UsbManager) ctx.getSystemService(Context.USB_SERVICE); conectar();/*from ww w . ja v a2 s. c o m*/ }
From source file:com.commonsware.android.andshooter.ScreenshotService.java
@Override public int onStartCommand(Intent i, int flags, int startId) { if (i.getAction() == null) { resultCode = i.getIntExtra(EXTRA_RESULT_CODE, 1337); resultData = i.getParcelableExtra(EXTRA_RESULT_INTENT); foregroundify();//from w w w. jav a2 s . c o m } else if (ACTION_RECORD.equals(i.getAction())) { if (resultData != null) { startCapture(); } else { Intent ui = new Intent(this, MainActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(ui); } } else if (ACTION_SHUTDOWN.equals(i.getAction())) { beeper.startTone(ToneGenerator.TONE_PROP_NACK); stopForeground(true); stopSelf(); } return (START_NOT_STICKY); }
From source file:com.keepe.plugins.cardio.CardIOMain.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == MY_SCAN_REQUEST_CODE) { if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) { CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT); JSONObject cardObj = new JSONObject(); try { cardObj.put("card_number", scanResult.cardNumber); cardObj.put("card_type", scanResult.getCardType().getDisplayName("en-US")); cardObj.put("redacted_card_number", scanResult.getFormattedCardNumber()); if (scanResult.isExpiryValid()) { cardObj.put("expiry_month", scanResult.expiryMonth); cardObj.put("expiry_year", scanResult.expiryYear); }// w ww . ja v a2s . com if (scanResult.cvv != null) { cardObj.put("cvv", scanResult.cvv); } if (scanResult.postalCode != null) { cardObj.put("zip", scanResult.postalCode); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } CardIO.cardNumber = cardObj; } } CardIOMain.this.finish(); }
From source file:codepath.watsiapp.activities.BaseFragmentActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { PaymentConfirmation confirm = data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION); if (confirm != null) { try { showThankYouNote();//from w w w . j a v a 2s.c o m ParseObject confirmation = new ParseObject("PaymentConfirmatons"); confirmation.put("donorName", getUserFullName()); confirmation.put("donorEmail", getUserEmail()); confirmation.put("patient", Patient.createWithoutData(Patient.class, getPatientId())); confirmation.put("amount", getDonationAmount()); confirmation.put("confirmation", confirm.toJSONObject().toString(4)); confirmation.put("isAnonymous", isAnonymousDonation()); confirmation.saveInBackground(); prefs.clear(); } catch (JSONException e) { Log.e(TAG_PAYPAL, "an extremely unlikely failure occurred: ", e); } } } else if (resultCode == Activity.RESULT_CANCELED) { Log.i(TAG_PAYPAL, "The user canceled."); } else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) { Log.i(TAG_PAYPAL, "An invalid Payment or PayPalConfiguration was submitted. Please see the docs."); } }