List of usage examples for android.content Intent getBundleExtra
public Bundle getBundleExtra(String name)
From source file:com.example.android.recipeassistant.RecipeService.java
private void createNotification(Intent intent) { mRecipe = Recipe.fromBundle(intent.getBundleExtra(Constants.EXTRA_RECIPE)); ArrayList<Notification> notificationPages = new ArrayList<Notification>(); int stepCount = mRecipe.recipeSteps.size(); for (int i = 0; i < stepCount; ++i) { Recipe.RecipeStep recipeStep = mRecipe.recipeSteps.get(i); NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle(); style.bigText(recipeStep.stepText); style.setBigContentTitle(/* www. ja v a 2 s .c o m*/ String.format(getResources().getString(R.string.step_count), i + 1, stepCount)); style.setSummaryText(""); NotificationCompat.Builder builder = new NotificationCompat.Builder(this); builder.setStyle(style); notificationPages.add(builder.build()); } NotificationCompat.Builder builder = new NotificationCompat.Builder(this); if (mRecipe.recipeImage != null) { Bitmap recipeImage = Bitmap.createScaledBitmap(AssetUtils.loadBitmapAsset(this, mRecipe.recipeImage), Constants.NOTIFICATION_IMAGE_WIDTH, Constants.NOTIFICATION_IMAGE_HEIGHT, false); builder.setLargeIcon(recipeImage); } builder.setContentTitle(mRecipe.titleText); builder.setContentText(mRecipe.summaryText); builder.setSmallIcon(R.mipmap.ic_notification_recipe); Notification notification = builder .extend(new NotificationCompat.WearableExtender().addPages(notificationPages)).build(); mNotificationManager.notify(Constants.NOTIFICATION_ID, notification); }
From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_browser.search.video.SignSearchVideoActivity.java
@NonNull private Parcelable getParcelable() { final Intent intent = getIntent(); final Bundle bundle = intent.getBundleExtra(EXTRA); Validate.notNull(bundle, "The bundle supplied to the activity is null."); this.originalQuery = bundle.getString(SignSearchActivity.QUERY); Validate.notNull(this.originalQuery, "Query string supplied to this activity is null."); final Parcelable parcelledSign = bundle.getParcelable(SignVideoFragment.SIGN_TO_SHOW); Validate.notNull(parcelledSign, "Parcelled sign supplied to this activity is null."); return parcelledSign; }
From source file:org.deviceconnect.android.deviceplugin.host.activity.GeolocationAlertDialogActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mActivity = this; Intent intent = getIntent(); Bundle bundle = intent.getBundleExtra("Intent"); if (bundle != null) { mResponse = bundle.getParcelable("response"); }//from w w w . j av a 2 s . c om getWindow().requestFeature(Window.FEATURE_ACTION_BAR); if (getActionBar() != null) { getActionBar().hide(); } setContentView(R.layout.geolocation_alert_dialog); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setTitle(R.string.gps_settings_title); alertDialogBuilder.setMessage(R.string.host_setting_dialog_disable_gps).setCancelable(false) // GPS?? .setPositiveButton(R.string.gps_settings_title, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent callGPSSettingIntent = new Intent( android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); try { startActivity(callGPSSettingIntent); } catch (ActivityNotFoundException e) { if (mResponse != null) { MessageUtils.setIllegalDeviceStateError(mResponse, "GPS setting is not enabled."); getBaseContext().sendBroadcast(mResponse); } } mActivity.finish(); } }); // ? alertDialogBuilder.setNegativeButton(R.string.host_setting_gps_dialog_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (mResponse != null) { MessageUtils.setIllegalDeviceStateError(mResponse, "GPS setting is not enabled."); getBaseContext().sendBroadcast(mResponse); } dialog.cancel(); mActivity.finish(); } }); AlertDialog alert = alertDialogBuilder.create(); // ?????? alert.show(); }
From source file:org.docrj.smartcard.reader.MsgParseActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); Bundle b = intent.getBundleExtra("parsed_msg"); String msgText = b.getString("text"); mMsgName = b.getString("name"); mHtml = b.getString("html"); mActivityName = b.getString("activity"); mTestMode = b.getInt("test_mode"); setContentView(R.layout.activity_msg_parse); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*from w w w . j ava 2 s .c om*/ // toolbar reference does not work for setting groupName getSupportActionBar().setTitle(mActivityName); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); TextView heading = (TextView) findViewById(R.id.heading); heading.setText(mMsgName); TextView contents = (TextView) findViewById(R.id.msg_text); contents.setText(msgText); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); w.setStatusBarColor(getResources().getColor(R.color.primary_dark)); } }
From source file:com.gigigo.vuforiaimplementation.VuforiaActivity.java
private void initVuforiaKeys(Intent intent) { Bundle b = intent.getBundleExtra(ImageRecognitionVuforiaImpl.IMAGE_RECOGNITION_CREDENTIALS); ParcelableVuforiaCredentials parcelableVuforiaCredentials = b .getParcelable(ImageRecognitionVuforiaImpl.IMAGE_RECOGNITION_CREDENTIALS); mCloudRecoCallBack = new CloudRecognitionActivityLifeCycleCallBack(this, this, parcelableVuforiaCredentials.getClientAccessKey(), parcelableVuforiaCredentials.getClientSecretKey(), parcelableVuforiaCredentials.getLicenseKey(), false);//from www . ja v a 2 s .c om }
From source file:com.artemchep.horario.ui.activities.ChildActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setupTheme();/*from ww w . j a va 2 s . c o m*/ setupContent(); if (savedInstanceState == null) { Intent intent = getIntent(); Bundle args = intent.getBundleExtra(EXTRA_FRAGMENT_ARGS); String clazzName = intent.getStringExtra(EXTRA_FRAGMENT_NAME); try { mFragment = (Fragment) Class.forName(clazzName).newInstance(); } catch (Exception e) { throw new RuntimeException(e); } mFragment.setArguments(args); getSupportFragmentManager().beginTransaction().add(R.id.content, mFragment, TAG_FRAGMENT).commit(); } else { mFragment = getSupportFragmentManager().getFragment(savedInstanceState, TAG_FRAGMENT); } }
From source file:pub.devrel.easygoogle.gcm.MessagingFragment.java
private void parseMessageIntent(Intent intent) { Bundle data = intent.getBundleExtra(MESSAGE_ARG); String from = intent.getStringExtra(MESSAGE_FROM_FIELD); onMessageReceived(from, data);// w w w .ja v a 2 s .c om }
From source file:com.lamcreations.scaffold.common.activities.BaseActivity.java
protected Bundle getArguments() { Bundle args = new Bundle(); Intent intent = getIntent(); if (intent.hasExtra(ScaffoldConstants.ARGS)) { args.putAll(intent.getBundleExtra(ScaffoldConstants.ARGS)); }/*from w w w .j a v a2 s .c o m*/ return args; }
From source file:com.gigigo.imagerecognition.vuforia.VuforiaActivity.java
private void initVuforiaKeys(Intent intent) { Bundle b = intent.getBundleExtra(ImageRecognitionVuforia.IMAGE_RECOGNITION_CREDENTIALS); ParcelableVuforiaCredentials parcelableVuforiaCredentials = b .getParcelable(ImageRecognitionVuforia.IMAGE_RECOGNITION_CREDENTIALS); mCloudRecoCallBack = new CloudRecognitionActivityLifeCycleCallBack(this, this, parcelableVuforiaCredentials.getClientAccessKey(), parcelableVuforiaCredentials.getClientSecretKey(), parcelableVuforiaCredentials.getLicenseKey(), false);//from w ww . ja v a 2 s. co m }
From source file:self.yue.vehicletracker.ui.history.HistoryDetailActivity.java
private void getData() { Intent intent = getIntent(); if (intent != null) { Bundle data = intent.getBundleExtra(CommonConstants.EXTRA_BUNDLE); if (data != null) { mHistory = data.getParcelable(CommonConstants.BUNDLE_HISTORY); mDate = data.getString(CommonConstants.BUNDLE_DATE); mLicensePlate = data.getString(CommonConstants.BUNDLE_LICENSE_PLATE); }// w ww. ja v a2s. com } mStartPosition = new LatLng(Double.parseDouble(mHistory.locations.get(0).latitude), Double.parseDouble(mHistory.locations.get(0).longitude)); mEndPosition = new LatLng( Double.parseDouble(mHistory.locations.get(mHistory.locations.size() - 1).latitude), Double.parseDouble(mHistory.locations.get(mHistory.locations.size() - 1).longitude)); }