List of usage examples for android.content Intent getParcelableExtra
public <T extends Parcelable> T getParcelableExtra(String name)
From source file:com.dimasdanz.kendalipintu.NFCOpenDoorActivity.java
private void handleIntent(Intent intent) { String action = intent.getAction(); if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) { String type = intent.getType(); if (MIME_TEXT_PLAIN.equals(type)) { Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); if (SharedPreferencesManager.getLoggedInPrefs(getApplicationContext())) { new NdefReaderTask().execute(tag); } else { Intent i = new Intent(getApplicationContext(), LoginActivity.class); startActivity(i);//from ww w .j a v a2s. co m } } else { Log.d(TAG, "Wrong mime type: " + type); } } }
From source file:com.ninetwozero.battlelog.ForumActivity.java
public void openFromIntent(Intent intent) { // Do we have a saved thread? if (intent.hasExtra("savedThread") && savedThread == null) { savedThread = intent.getParcelableExtra("savedThread"); openForum(new Intent().putExtra("forumTitle", "N/A").putExtra("forumId", savedThread.getForumId())); openThread(new Intent().putExtra("threadTitle", savedThread.getTitle()) .putExtra("threadId", savedThread.getId()) .putExtra("pageId", savedThread.getNumPageLastRead())); }/*from w w w.j a v a 2 s. co m*/ }
From source file:com.radiofarda.istgah.ui.FullScreenPlayerActivity.java
private void updateFromParams(Intent intent) { if (intent != null) { MediaDescriptionCompat description = intent .getParcelableExtra(PodcastsActivity.EXTRA_CURRENT_MEDIA_DESCRIPTION); if (description != null) { updateMediaDescription(description); }/*from w ww . j a v a 2 s . com*/ } }
From source file:com.markupartist.sthlmtraveling.SearchDeparturesFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { getLoaderManager().restartLoader(LOADER_HISTORY, null, this); switch (requestCode) { case REQUEST_CODE_PICK_SITE: if (resultCode == Activity.RESULT_OK) { dispatchSearch((Site) data.getParcelableExtra(PlaceSearchActivity.EXTRA_PLACE)); }/* w w w . j a v a 2 s .co m*/ break; } }
From source file:cat.terrones.devops.radiofx.ui.FullScreenPlayerActivity.java
private void updateFromParams(Intent intent) { if (intent != null) { MediaDescriptionCompat description = intent .getParcelableExtra(MusicPlayerActivity.EXTRA_CURRENT_MEDIA_DESCRIPTION); if (description != null) { updateMediaDescription(description); }//from w w w . j a v a 2 s . c o m } }
From source file:com.example.hp.smartstor.CloudMusicManager.uamp.ui.FullScreenPlayerActivity.java
private void updateFromParams(Intent intent) { if (intent != null) { MediaDescriptionCompat description = intent.getParcelableExtra( com.example.hp.smartstor.CloudMusicManager.uamp.ui.MusicPlayerActivity.EXTRA_CURRENT_MEDIA_DESCRIPTION); if (description != null) { updateMediaDescription(description); }/* www. ja va 2 s .com*/ } }
From source file:com.fabioarias.ui.Search.java
public void onActivityResult(int requestCode, int resultCode, Intent intent) { Log.i("SEARCH FRAG", requestCode + "-----------------"); if (requestCode == 0 && resultCode == BaseBarcodeActivity.RESULT_OK) { Pdf417MobiScanData scanData = intent.getParcelableExtra(BaseBarcodeActivity.EXTRAS_RESULT); String barcodeType = scanData.getBarcodeType(); String barcodeData = scanData.getBarcodeData(); /*/*from w ww.jav a2 s . c om*/ * if (resultCode == Intent.RESULT_OK) { * tvStatus.setText(intent.getStringExtra("SCAN_RESULT_FORMAT")); * tvResult.setText(intent.getStringExtra("SCAN_RESULT")); } else if * (resultCode == RESULT_CANCELED) { * tvStatus.setText("Press a button to start a scan."); * tvResult.setText("Scan cancelled."); } */ Log.i("RESULT", resultCode + " -- " + barcodeData); } }
From source file:com.rks.musicx.services.MediaButtonReceiver.java
@Override public void onReceive(Context context, Intent intent) { String intentAction = intent.getAction(); String command = null;/*from ww w. j a v a 2 s.c om*/ if (intent.getAction() != null) { if (intentAction.equals(Intent.ACTION_MEDIA_BUTTON)) { KeyEvent event = (KeyEvent) intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT); if (event == null) { return; } int keycode = event.getKeyCode(); final int action = event.getAction(); final long eventTime = event.getEventTime(); switch (keycode) { case KeyEvent.KEYCODE_MEDIA_STOP: Log.d(TAG, "stop"); command = Constants.ACTION_STOP; break; case KeyEvent.KEYCODE_HEADSETHOOK: case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: Log.d(TAG, "toggle"); command = Constants.ACTION_TOGGLE; break; case KeyEvent.KEYCODE_MEDIA_NEXT: Log.d(TAG, "next"); command = Constants.ACTION_NEXT; break; case KeyEvent.KEYCODE_MEDIA_PREVIOUS: Log.d(TAG, "prev"); command = Constants.ACTION_PREVIOUS; break; case KeyEvent.KEYCODE_MEDIA_PAUSE: Log.d(TAG, "pause"); command = Constants.ACTION_PAUSE; break; case KeyEvent.KEYCODE_MEDIA_PLAY: Log.d(TAG, "play"); command = Constants.ACTION_PLAY; break; } // startServices(context, command); if (command != null) { if (action == KeyEvent.ACTION_DOWN) { if (event.getRepeatCount() == 0) { if (keycode == KeyEvent.KEYCODE_HEADSETHOOK) { if (eventTime - mLastClickTime >= DOUBLE_CLICK) { mClickCounter = 0; } mClickCounter++; Log.e("MediaButton", "Got headset click, count = " + mClickCounter); mHandler.removeMessages(MSG_HEADSET_DOUBLE_CLICK_TIMEOUT); Message msg = mHandler.obtainMessage(MSG_HEADSET_DOUBLE_CLICK_TIMEOUT, mClickCounter, 0, context); long delay = mClickCounter < 3 ? DOUBLE_CLICK : 0; if (mClickCounter >= 3) { mClickCounter = 0; } mLastClickTime = eventTime; acquireWakeLockAndSendMessage(context, msg, delay); } else { startServices(context, command); } } } } } } }
From source file:com.nbplus.vbroadlauncher.RealtimeBroadcastProxyActivity.java
@Override public void onCheckResult(TextToSpeech tts) { if (tts != null) { Intent intent = getIntent(); Intent i = new Intent(this, BroadcastChatHeadService.class); i.putExtra(Constants.EXTRA_BROADCAST_PAYLOAD_INDEX, mBroadcastPayloadIdx); i.putExtra(Constants.EXTRA_BROADCAST_PAYLOAD_DATA, intent.getParcelableExtra(Constants.EXTRA_BROADCAST_PAYLOAD_DATA)); startService(i);/* w w w . j a va2s . co m*/ } }
From source file:com.andernity.launcher2.InstallShortcutReceiver.java
public void onReceive(Context context, Intent data) { if (!ACTION_INSTALL_SHORTCUT.equals(data.getAction())) { return;/*from www. j av a 2 s .c o m*/ } Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); if (intent == null) { return; } // This name is only used for comparisons and notifications, so fall back to activity name // if not supplied String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); if (name == null) { try { PackageManager pm = context.getPackageManager(); ActivityInfo info = pm.getActivityInfo(intent.getComponent(), 0); name = info.loadLabel(pm).toString(); } catch (PackageManager.NameNotFoundException nnfe) { return; } } Bitmap icon = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON); Intent.ShortcutIconResource iconResource = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE); // Queue the item up for adding if launcher has not loaded properly yet boolean launcherNotLoaded = LauncherModel.getCellCountX() <= 0 || LauncherModel.getCellCountY() <= 0; PendingInstallShortcutInfo info = new PendingInstallShortcutInfo(data, name, intent); info.icon = icon; info.iconResource = iconResource; if (mUseInstallQueue || launcherNotLoaded) { String spKey = LauncherApplication.getSharedPreferencesKey(); SharedPreferences sp = context.getSharedPreferences(spKey, Context.MODE_PRIVATE); addToInstallQueue(sp, info); } else { processInstallShortcut(context, info); } }