List of usage examples for android.content Intent getExtras
public @Nullable Bundle getExtras()
From source file:com.groundupworks.wings.facebook.FacebookEndpoint.java
/** * Finishes a {@link com.groundupworks.wings.facebook.FacebookEndpoint#startSettingsRequest(android.app.Activity, android.support.v4.app.Fragment)}. * * @param requestCode the integer 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 data an Intent, which can return result data to the caller (various data can be attached to Intent * "extras")./*from w ww.ja va 2s .c o m*/ * @return the settings; or null if failed. */ private FacebookSettings finishSettingsRequest(int requestCode, int resultCode, Intent data) { FacebookSettings settings = null; if (requestCode == SETTINGS_REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null) { // Construct settings from the extras bundle. settings = FacebookSettings.newInstance(data.getExtras()); } return settings; }
From source file:com.RSMSA.policeApp.OffenceReportForm.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REPORT_RESULT) { if (resultCode == RESULT_OK) { // code for result final Bundle bundle = data.getExtras(); Log.d("Database", "count at parent is " + count); desc = bundle.getStringArrayList("desc"); type = bundle.getStringArrayList("type"); uids = bundle.getStringArrayList("uids"); OffenseListActivity.offenseDesc.clear(); backFromChild = true;//from ww w . ja v a 2 s . com Log.d(TAG, "number of ids = " + uids.size()); try { Log.d(TAG, " test data = " + invalidLicence); } catch (Exception e) { } if (invalidLicence != null && !invalidLicence.equals("")) { String offenceUid = invalidLicence; boolean offenceIncluded = false; for (String i : uids) { if (offenceUid.equals(i)) { offenceIncluded = true; } } if (!offenceIncluded) { Log.d(TAG, " desc sze before = " + desc.size()); IroadDatabase db = new IroadDatabase(getApplicationContext()); int counter = uids.size(); uids.add(offenceUid); desc.add(db.getAnOffenceDetail(false, offenceUid)); type.add(db.getAnOffenceDetail(true, offenceUid)); } } //TODO implement the above for expired licence count = desc.size(); int counter = desc.size(); if (counter > 0) { offencesSelectedTextView.setVisibility(View.VISIBLE); submit_layout1.setVisibility(View.VISIBLE); } else { offencesSelectedTextView.setVisibility(View.GONE); submit_layout1.setVisibility(View.GONE); } offencesSelected = ""; for (int i = 0; i < counter; i++) { if (i == counter - 1) { offencesSelected = offencesSelected + desc.get(i); offenceList = offenceList + desc.get(i); } else { offencesSelected = offencesSelected + desc.get(i) + "\n\n"; offenceList = offenceList + desc.get(i) + ","; } } offencesSelectedTextView.setText(offencesSelected); offensesCommittedTextview.setText(offencesSelected); amountToReport = 0; for (int i = 0; i < count; i++) { Log.d(TAG, "type = " + type.get(i)); try { amountToReport += Integer.parseInt(type.get(i)); } catch (Exception e) { e.printStackTrace(); } } Log.d(TAG, "amount to report = " + amountToReport); TextView offenceCost = (TextView) findViewById(R.id.costs); offenceCost.setTypeface(MainOffence.Roboto_Regular); offenceCost.setText(amountToReport + ""); } if (resultCode == RESULT_CANCELED) { } } }
From source file:com.bonsai.wallet32.WalletService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { // Establish our SyncState mSyncState = SyncState.STARTUP;/* w w w.j av a 2s . c o m*/ if (intent != null) { Bundle bundle = intent.getExtras(); String syncStateStr = bundle.getString("SyncState"); if (syncStateStr != null) mSyncState = syncStateStr.equals("CREATED") ? SyncState.CREATED : syncStateStr.equals("RESTORE") ? SyncState.RESTORE : syncStateStr.equals("STARTUP") ? SyncState.STARTUP : syncStateStr.equals("RESCAN") ? SyncState.RESCAN : syncStateStr.equals("RERESCAN") ? SyncState.RERESCAN : SyncState.STARTUP; } mKeyCrypter = mApp.mKeyCrypter; mAesKey = mApp.mAesKey; // Set any new key's creation time to now. long now = Utils.now().getTime() / 1000; mTask = new SetupWalletTask(); mTask.execute(now); mLogger.info("WalletService started"); showStatusNotification(); mIsRunning = true; return Service.START_STICKY; }
From source file:com.google.android.apps.muzei.api.MuzeiArtSource.java
@Override protected void onHandleIntent(Intent intent) { if (intent == null) { return;//from ww w.j av a2 s . com } String action = intent.getAction(); // TODO: permissions? if (ACTION_SUBSCRIBE.equals(action)) { processSubscribe((ComponentName) intent.getParcelableExtra(EXTRA_SUBSCRIBER_COMPONENT), intent.getStringExtra(EXTRA_TOKEN)); } else if (ACTION_HANDLE_COMMAND.equals(action)) { int commandId = intent.getIntExtra(EXTRA_COMMAND_ID, 0); processHandleCommand(commandId, intent.getExtras()); } else if (ACTION_NETWORK_AVAILABLE.equals(action)) { processNetworkAvailable(); } }
From source file:com.actionlauncher.api.LiveWallpaperSource.java
@Override protected void onHandleIntent(Intent intent) { if (intent == null) { return;/* w w w. j a v a 2 s . c om*/ } String action = intent.getAction(); LOGD("LiveWallpaperSource.onHandleIntent() - action:" + action + ", id:" + mName); // TODO: permissions? if (ACTION_SUBSCRIBE.equals(action)) { processSubscribe((ComponentName) intent.getParcelableExtra(EXTRA_SUBSCRIBER_COMPONENT), intent.getStringExtra(EXTRA_TOKEN)); } else if (ACTION_FETCH_PALETTE.equals(action)) { publishCurrentPalette(); } else if (action.equals(ProtocolConstants.ACTION_PUBLISH_STATE)) { boolean wallpaperInfoSet = false; if (intent.hasExtra(EXTRA_LIVE_WALLPAPER_INFO)) { Bundle bundle = intent.getExtras().getBundle(EXTRA_LIVE_WALLPAPER_INFO); if (bundle != null) { LiveWallpaperInfo info = LiveWallpaperInfo.fromBundle(bundle); mCurrentState.setCurrentLiveWallpaperInfo(info); LOGD("LiveWallpaperInfo.fromBundle():" + (info != null ? info.toString() : null)); wallpaperInfoSet = true; } } if (!wallpaperInfoSet) { mCurrentState.setCurrentLiveWallpaperInfo(null); } publishCurrentPalette(); } }
From source file:edu.mit.mobile.android.locast.data.Sync.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { if (Intent.ACTION_SYNC.equals(intent.getAction())) { if (intent.getBooleanExtra(EXTRA_EXPLICIT_SYNC, false)) { mNotifiedUserAboutNetworkStatus = true; mShouldAlertUserOnSuccess = true; }/*from ww w.ja v a 2 s . c o m*/ startSync(intent.getData(), intent.getExtras()); } else if (ACTION_CANCEL_SYNC.equals(intent.getAction())) { stopSync(); } } else { // restarted by system. startSync(); } return START_NOT_STICKY; }
From source file:com.photon.phresco.nativeapp.eshop.activity.ProductReviewCommentActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); PhrescoLogger.info(TAG + " - onActivityResult"); try {//w ww .j av a 2 s .com if (resultCode == RESULT_OK && requestCode == 1) { PhrescoLogger .info(TAG + " - onActivityResult === OOOOOOOO == previousActivity : " + previousActivity); PhrescoLogger .info(TAG + " - onActivityResult === OOOOOOOO == currentActivity : " + currentActivity); Intent loginIntent = new Intent(getApplicationContext(), LoginActivity.class); loginIntent.putExtra(currActivity, currentActivity); loginIntent.putExtra(prevActivity, data.getExtras().getString(prevActivity)); loginIntent.putExtra(product, productItem); startActivity(loginIntent); finish(); } } catch (Exception ex) { PhrescoLogger.info(TAG + " - backButton - Exception : " + ex.toString()); PhrescoLogger.warning(ex); } }
From source file:com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPushIntentService.java
private Intent handleMessageIntent(Intent intent, Bundle extras) { String action = extras.getString(ACTION); if (action != null && action.equals(DISMISS_NOTIFICATION)) { logger.debug("MFPPushIntentService:handleMessageIntent() - Dismissal message from GCM Server"); dismissNotification(extras.getString(NID)); } else {/* w ww . j a v a2 s. co m*/ GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(getApplicationContext()); String messageType = gcm.getMessageType(intent); if (!extras.isEmpty()) { if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) { logger.debug("MFPPushIntentService:handleMessageIntent() - Received a message from GCM Server." + intent.getExtras()); MFPInternalPushMessage message = new MFPInternalPushMessage(intent); intent = new Intent(MFPPushUtils.getIntentPrefix(getApplicationContext()) + GCM_MESSAGE); intent.putExtra(GCM_EXTRA_MESSAGE, message); if (!isAppForeground()) { logger.debug( "MFPPushIntentService:handleMessageIntent() - App is not on foreground. Queue the intent for later re-sending when app is on foreground"); intentsQueue.add(intent); } getApplicationContext().sendOrderedBroadcast(intent, null, resultReceiver, null, Activity.RESULT_FIRST_USER, null, null); } } } return intent; }
From source file:com.fsm.storybook.launcher.WebViewActivity.java
/** * To receive TOC selection result or Viewer Setting result *//* w w w .j ava 2s . co m*/ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(TAG, "onActivityResult"); super.onActivityResult(requestCode, resultCode, data); if (data == null) return; switch (requestCode) { case REQUEST_TOC: if (data.getExtras().containsKey(Constants.TOC_ITEM)) { String content = data.getExtras().getString(Constants.TOC_ITEM); Log.d(TAG, "Got activity result from TOC selection, open content : " + content); NavigationTable toc = mContainer.getDefaultPackage().getTableOfContents(); mReadiumJSApi.openContentUrl(content, toc.getSourceHref()); } else if (data.getExtras().containsKey(Constants.BOOKMARK_CFI)) { String idref = data.getExtras().getString(Constants.SPINE_IDREF); String cfi = data.getExtras().getString(Constants.BOOKMARK_CFI); Log.d(TAG, "Got activity result from Bookmark selection, open cfi : " + idref + ", " + cfi); mReadiumJSApi.openSpineItemElementCfi(idref, cfi); } else if (data.getExtras().containsKey(Constants.HIGHLIGHT_CFI)) { String idref = data.getExtras().getString(Constants.SPINE_IDREF); String cfi = data.getExtras().getString(Constants.HIGHLIGHT_CFI); Log.d(TAG, "Got activity result from Highlight selection, open cfi : " + idref + ", " + cfi); mReadiumJSApi.openSpineItemElementCfi(idref, cfi); } break; case REQUEST_SETTING: Log.d(TAG, "Got activity result from ViewerSetting "); /* boolean fontChanged = false; int fontSize = data.getExtras().getInt(Constants.SETTING_FONT_SIZE); */ int speadCount = data.getExtras().getInt(Constants.SETTING_SPREAD_COUNT); //??? /* if (mBookData.getFontSize()!=fontSize) fontChanged = true; mBookData.setFontSize(fontSize); */ mBookData.setSpreadCount(speadCount); bkdb.updateBook(mBookData); //mViewerSettings = new ViewerSettings(speadCount==2, fontSize, 20); mViewerSettings = new ViewerSettings(speadCount == 2, mBookData.getFontSize(), 20); mReadiumJSApi.updateSettings(mViewerSettings); /* if (fontChanged) { mBookData.clearTotalPageCount(); startCalculateTotalPageCount(); } */ default: break; } }
From source file:com.nextgis.maplibui.service.LayerFillService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.i("LayerFillService", "Received start id " + startId + ": " + intent); if (intent != null) { String action = intent.getAction(); if (!TextUtils.isEmpty(action)) { switch (action) { case ACTION_ADD_TASK: int layerGroupId = intent.getIntExtra(KEY_LAYER_GROUP_ID, Constants.NOT_FOUND); mLayerGroup = (LayerGroup) MapBase.getInstance().getLayerById(layerGroupId); Bundle extra = intent.getExtras(); int layerType = extra.getInt(KEY_INPUT_TYPE, Constants.NOT_FOUND); switch (layerType) { case VECTOR_LAYER: mQueue.add(new VectorLayerFillTask(extra)); break; case VECTOR_LAYER_WITH_FORM: mQueue.add(new UnzipForm(extra)); break; case TMS_LAYER: mQueue.add(new LocalTMSFillTask(extra)); break; case NGW_LAYER: mQueue.add(new NGWVectorLayerFillTask(extra)); break; }/* ww w.java2s .co m*/ if (!mIsRunning) { startNextTask(); } return START_STICKY; case ACTION_STOP: mQueue.clear(); mIsCanceled = true; break; case ACTION_SHOW: mProgressIntent.putExtra(KEY_STATUS, STATUS_SHOW).putExtra(KEY_TITLE, mBuilder.mContentTitle); sendBroadcast(mProgressIntent); break; } } } return START_STICKY; }