List of usage examples for android.content Intent putExtras
public @NonNull Intent putExtras(@NonNull Bundle extras)
From source file:com.app.jdy.ui.CashAdvanceActivity.java
private void addEvents() { button.setOnClickListener(new OnClickListener() { @Override//from ww w . j av a2 s. c o m public void onClick(View v) { // ???? if (HttpUtils.isNetworkConnected(CashAdvanceActivity.this)) { if (editText.getText().toString().length() == 0) { Toast.makeText(CashAdvanceActivity.this, "?", Toast.LENGTH_SHORT).show(); } else { // ? int count = 0, start = 0; while ((start = editText.getText().toString().indexOf(".", start)) >= 0) { start += ".".length(); count++; } if (count > 1 || editText.getText().toString().indexOf(".") == 0) { Toast.makeText(CashAdvanceActivity.this, "", Toast.LENGTH_SHORT) .show(); } else { // ????? BigDecimal judgemoney = null; try { judgemoney = new BigDecimal(editText.getText().toString()); } catch (NumberFormatException e) { Toast.makeText(CashAdvanceActivity.this, "", Toast.LENGTH_SHORT).show(); return; } judgemoney = judgemoney.setScale(2, BigDecimal.ROUND_HALF_UP); // ????? String judgecanWithdCash = textView2.getText().toString(); if (textView4.getText().toString().equals("?") || textView4.getText().toString().length() == 0 || textView3.getText().toString().length() == 0) { Toast.makeText(CashAdvanceActivity.this, "?", Toast.LENGTH_SHORT) .show(); } else if (judgemoney.toString() == "0.00") { Toast.makeText(CashAdvanceActivity.this, "?0?", Toast.LENGTH_SHORT).show(); } else if (judgemoney .compareTo(BigDecimal.valueOf(Double.valueOf(judgecanWithdCash))) == 1) { // BigDecimalcompareTo-1 ? 0 // 1 Toast.makeText(CashAdvanceActivity.this, "??????", Toast.LENGTH_LONG).show(); } else { editText.setText(judgemoney.toString()); withdrawCashDialog = new WithdrawCashDialog(CashAdvanceActivity.this, R.style.ForwardDialog, judgemoney.toString()); withdrawCashDialog.show(); } } } } else { // ?? Toast.makeText(CashAdvanceActivity.this, Constants.NO_INTENT_TIPS, Toast.LENGTH_LONG).show(); } } }); // ?????? findViewById(R.id.cash_textView5).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(CashAdvanceActivity.this, BankCardActivity.class); Bundle bundle = new Bundle(); bundle.putBoolean("isOk", true); intent.putExtras(bundle); startActivity(intent); finish(); } }); }
From source file:org.zywx.wbpalmstar.platform.push.PushRecieveMsgReceiver.java
private void buildPushNotification(Context context, Intent intent, PushDataInfo dataInfo) { String title = dataInfo.getTitle(); String body = dataInfo.getAlert(); String message = dataInfo.getPushDataString(); Builder builder = new Builder(context); builder.setAutoCancel(true);/* w ww .ja v a2s . com*/ builder.setContentTitle(title); // builder.setContentText(body); // builder.setTicker(body); // ?? String[] remindType = dataInfo.getRemindType(); if (remindType != null) { if (remindType.length == 3) { builder.setDefaults(Notification.DEFAULT_ALL); } else { int defaults = 0; for (int i = 0; i < remindType.length; i++) { if ("sound".equalsIgnoreCase(remindType[i])) { defaults = Notification.DEFAULT_SOUND; continue; } if ("shake".equalsIgnoreCase(remindType[i])) { defaults = defaults | Notification.DEFAULT_VIBRATE; continue; } if ("breathe".equalsIgnoreCase(remindType[i])) { defaults = defaults | Notification.DEFAULT_LIGHTS; continue; } } builder.setDefaults(defaults); } } Resources res = context.getResources(); int icon = res.getIdentifier("icon", "drawable", intent.getPackage()); builder.setSmallIcon(icon); builder.setWhen(System.currentTimeMillis()); // String iconUrl = dataInfo.getIconUrl(); boolean isDefaultIcon = !TextUtils.isEmpty(iconUrl) && "default".equalsIgnoreCase(iconUrl); Bitmap bitmap = null; if (!isDefaultIcon) { bitmap = getIconBitmap(context, iconUrl); } String fontColor = dataInfo.getFontColor(); RemoteViews remoteViews = null; if (!TextUtils.isEmpty(fontColor)) { int color = BUtility.parseColor(fontColor); int alphaColor = parseAlphaColor(fontColor); remoteViews = new RemoteViews(intent.getPackage(), EUExUtil.getResLayoutID("push_notification_view")); // Title remoteViews.setTextViewText(EUExUtil.getResIdID("notification_title"), title); remoteViews.setTextColor(EUExUtil.getResIdID("notification_title"), color); // Body remoteViews.setTextViewText(EUExUtil.getResIdID("notification_body"), body); remoteViews.setTextColor(EUExUtil.getResIdID("notification_body"), alphaColor); // LargeIcon if (bitmap != null) { remoteViews.setImageViewBitmap(EUExUtil.getResIdID("notification_largeIcon"), bitmap); } else { remoteViews.setImageViewResource(EUExUtil.getResIdID("notification_largeIcon"), EUExUtil.getResDrawableID("icon")); } // Time SimpleDateFormat format = new SimpleDateFormat("HH:mm"); remoteViews.setTextViewText(EUExUtil.getResIdID("notification_time"), format.format(System.currentTimeMillis())); remoteViews.setTextColor(EUExUtil.getResIdID("notification_time"), alphaColor); builder.setContent(remoteViews); } Intent notiIntent = new Intent(context, EBrowserActivity.class); notiIntent.putExtra("ntype", F_TYPE_PUSH); notiIntent.putExtra("data", body); notiIntent.putExtra("message", message); Bundle bundle = new Bundle(); bundle.putSerializable(PushReportConstants.PUSH_DATA_INFO_KEY, dataInfo); notiIntent.putExtras(bundle); PendingIntent pendingIntent = PendingIntent.getActivity(context, notificationNB, notiIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(pendingIntent); NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = builder.build(); // Android v4bug2.3?Builder?NotificationRemoteView?? if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && remoteViews != null) { notification.contentView = remoteViews; } manager.notify(notificationNB, notification); notificationNB++; }
From source file:com.facebook.share.internal.LikeActionController.java
private static void broadcastAction(LikeActionController controller, String action, Bundle data) { Intent broadcastIntent = new Intent(action); if (controller != null) { if (data == null) { data = new Bundle(); }//from w ww.j a v a2 s. co m data.putString(ACTION_OBJECT_ID_KEY, controller.getObjectId()); } if (data != null) { broadcastIntent.putExtras(data); } LocalBroadcastManager.getInstance(FacebookSdk.getApplicationContext()).sendBroadcast(broadcastIntent); }
From source file:com.hybris.mobile.activity.OrderDetailActivity.java
private void handleIntent(Intent intent) { if (Hybris.isUserLoggedIn()) { if (intent.hasExtra("orderDetails")) { ((TextView) findViewById(R.id.lbl_thankYou)).setVisibility(View.VISIBLE); ((TextView) findViewById(R.id.lbl_orderConfirmation)).setVisibility(View.VISIBLE); // TODO setmOrderDetails(JsonUtils.fromJson(intent.getStringExtra("orderDetails"), CartOrder.class)); }//from w w w.j a va2 s . co m if (intent.hasExtra(DataConstants.ORDER_ID)) { setmOrderID(intent.getStringExtra(DataConstants.ORDER_ID)); } // Call from another application (QR Code) else if (StringUtils.equals(intent.getAction(), Intent.ACTION_VIEW)) { setmOrderID(RegexUtil.getOrderIdFromHybrisPattern(intent.getDataString())); } } // User not logged in, redirection to the login page else { Intent loginIntent = new Intent(this, LoginActivity.class); // Call from another application (QR Code) if (StringUtils.equals(intent.getAction(), Intent.ACTION_VIEW)) { loginIntent.putExtra(DataConstants.ORDER_ID, RegexUtil.getOrderIdFromHybrisPattern(intent.getDataString())); } loginIntent.putExtra(DataConstants.INTENT_DESTINATION, DataConstants.INTENT_ORDER_DETAILS); loginIntent.putExtras(intent); startActivity(loginIntent); } }
From source file:com.fbbackup.TagMeImageGridFragment.java
@TargetApi(16) @Override/*from ww w .j a va 2 s. c om*/ public void onItemClick(AdapterView<?> parent, View v, int position, long id) { final Intent i = new Intent(getActivity(), TagImageDetailActivity.class); Bundle bundle = new Bundle(); bundle.putStringArray("photo", tagMePicture); bundle.putString("userName", name); i.putExtras(bundle); i.putExtra(ImageDetailActivity.EXTRA_IMAGE, (int) id); if (Utils.hasJellyBean()) { // makeThumbnailScaleUpAnimation() looks kind of ugly here as the // loading spinner may // show plus the thumbnail image in GridView is cropped. so using // makeScaleUpAnimation() instead. ActivityOptions options = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getWidth(), v.getHeight()); getActivity().startActivity(i, options.toBundle()); } else { startActivity(i); } }
From source file:com.battlelancer.seriesguide.ui.ShowFragment.java
private void populateShow() { if (mShowCursor == null) { return;/*w w w . j a va 2 s .co m*/ } // title mShowTitle = mShowCursor.getString(ShowQuery.TITLE); mShowPoster = mShowCursor.getString(ShowQuery.POSTER); // status if (mShowCursor.getInt(ShowQuery.STATUS) == 1) { mTextViewStatus.setTextColor(getResources().getColor( Utils.resolveAttributeToResourceId(getActivity().getTheme(), R.attr.textColorSgGreen))); mTextViewStatus.setText(getString(R.string.show_isalive)); } else { mTextViewStatus.setTextColor(Color.GRAY); mTextViewStatus.setText(getString(R.string.show_isnotalive)); } // release time String releaseDay = mShowCursor.getString(ShowQuery.RELEASE_DAY); long releaseTime = mShowCursor.getLong(ShowQuery.RELEASE_TIME_MS); String releaseCountry = mShowCursor.getString(ShowQuery.RELEASE_COUNTRY); if (!TextUtils.isEmpty(releaseDay)) { String[] values = TimeTools.formatToShowReleaseTimeAndDay(getActivity(), releaseTime, releaseCountry, releaseDay); mTextViewReleaseTime.setText(values[1] + " " + values[0]); } else { mTextViewReleaseTime.setText(null); } // runtime mTextViewRuntime.setText(getString(R.string.runtime_minutes, mShowCursor.getInt(ShowQuery.RUNTIME))); // network mTextViewNetwork.setText(mShowCursor.getString(ShowQuery.NETWORK)); // favorite button final boolean isFavorite = mShowCursor.getInt(ShowQuery.IS_FAVORITE) == 1; mButtonFavorite.setEnabled(true); Utils.setCompoundDrawablesRelativeWithIntrinsicBounds(mButtonFavorite, 0, Utils.resolveAttributeToResourceId(getActivity().getTheme(), isFavorite ? R.attr.drawableStar : R.attr.drawableStar0), 0, 0); mButtonFavorite.setText(isFavorite ? R.string.context_unfavorite : R.string.context_favorite); CheatSheet.setup(mButtonFavorite, isFavorite ? R.string.context_unfavorite : R.string.context_favorite); mButtonFavorite.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // disable until action is complete v.setEnabled(false); ShowTools.get(v.getContext()).storeIsFavorite(getShowTvdbId(), !isFavorite); } }); // overview mTextViewOverview.setText(mShowCursor.getString(ShowQuery.OVERVIEW)); // country for release time calculation // show "unknown" if country is not supported mTextViewReleaseCountry.setText( TimeTools.isUnsupportedCountry(releaseCountry) ? getString(R.string.unknown) : releaseCountry); // original release String firstRelease = mShowCursor.getString(ShowQuery.FIRST_RELEASE); Utils.setValueOrPlaceholder(mTextViewFirstRelease, TimeTools.getShowReleaseYear(firstRelease, releaseTime, releaseCountry)); // content rating Utils.setValueOrPlaceholder(mTextViewContentRating, mShowCursor.getString(ShowQuery.CONTENT_RATING)); // genres Utils.setValueOrPlaceholder(mTextViewGenres, Utils.splitAndKitTVDBStrings(mShowCursor.getString(ShowQuery.GENRES))); // TVDb rating String tvdbRating = mShowCursor.getString(ShowQuery.TVDB_RATING); if (!TextUtils.isEmpty(tvdbRating)) { mTextViewTvdbRating.setText(tvdbRating); } // last edit long lastEditRaw = mShowCursor.getLong(ShowQuery.LAST_EDIT_MS); if (lastEditRaw > 0) { mTextViewLastEdit.setText(DateUtils.formatDateTime(getActivity(), lastEditRaw * 1000, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME)); } else { mTextViewLastEdit.setText(R.string.unknown); } // IMDb button String imdbId = mShowCursor.getString(ShowQuery.IMDBID); ServiceUtils.setUpImdbButton(imdbId, mButtonImdb, TAG, getActivity()); // TVDb button ServiceUtils.setUpTvdbButton(getShowTvdbId(), mButtonTvdb, TAG); // trakt button ServiceUtils.setUpTraktButton(getShowTvdbId(), mButtonTrakt, TAG); // web search button ServiceUtils.setUpWebSearchButton(mShowTitle, mButtonWebSearch, TAG); // shout button mButtonComments.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(getActivity(), TraktShoutsActivity.class); i.putExtras(TraktShoutsActivity.createInitBundleShow(mShowTitle, getShowTvdbId())); ActivityCompat.startActivity(getActivity(), i, ActivityOptionsCompat .makeScaleUpAnimation(v, 0, 0, v.getWidth(), v.getHeight()).toBundle()); fireTrackerEvent("Shouts"); } }); // poster, full screen poster button final View posterContainer = getView().findViewById(R.id.containerShowPoster); final ImageView posterView = (ImageView) posterContainer.findViewById(R.id.imageViewShowPoster); Utils.loadPoster(getActivity(), posterView, mShowPoster); posterContainer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent fullscreen = new Intent(getActivity(), FullscreenImageActivity.class); fullscreen.putExtra(FullscreenImageActivity.InitBundle.IMAGE_PATH, TheTVDB.buildScreenshotUrl(mShowPoster)); ActivityCompat.startActivity(getActivity(), fullscreen, ActivityOptionsCompat .makeScaleUpAnimation(v, 0, 0, v.getWidth(), v.getHeight()).toBundle()); } }); // background ImageView background = (ImageView) getView().findViewById(R.id.imageViewShowPosterBackground); Utils.loadPosterBackground(getActivity(), background, mShowPoster); onLoadTraktRatings(true); }
From source file:com.bczm.widgetcollections.player.MusicPlayer.java
private void sendPlayBundle() { Intent intent = new Intent(Constants.ACTION_MUSIC_BUNDLE_BROADCAST); Bundle extras = new Bundle(); LogUtils.e("sendPlayBundle-------------------------------->" + getDuration()); extras.putInt(Constants.KEY_MUSIC_TOTAL_DURATION, getDuration()); extras.putParcelable(Constants.KEY_MUSIC_PARCELABLE_DATA, mMusicList.get(mCurPlayIndex)); intent.putExtras(extras); mContext.sendBroadcast(intent);//from w w w . j a va 2 s . c om }
From source file:com.chalmers.feedlr.service.DataService.java
public void updateFeedFacebookItems(final Feed feed) { final long time = System.currentTimeMillis(); final List<User> facebookUsersInFeed = new ArrayList<User>(); final List<FacebookItem> facebookItemsForUsers = new ArrayList<FacebookItem>(); Cursor c = db.getUsers(feed, "facebook"); c.moveToFirst();/* ww w . j av a 2 s .c om*/ while (!c.isAfterLast()) { facebookUsersInFeed.add(new User(c.getString(c.getColumnIndex(DatabaseHelper.USER_COLUMN_USERID)), c.getString(c.getColumnIndex(DatabaseHelper.USER_COLUMN_USERNAME)))); c.moveToNext(); } facebook.getFeedsForUsers(facebookUsersInFeed, new com.facebook.android.AsyncFacebookRunner.RequestListener() { private int responses = 0; @Override public void onComplete(String response, Object state) { try { if (response != null) { facebookItemsForUsers.addAll(new FacebookJSONParser().parseFeed(response)); } } catch (Exception e) { Log.e(getClass().getName(), e.getMessage()); } responses++; if (responses == facebookUsersInFeed.size()) { onAllComplete(); } } private void onAllComplete() { db.addListOfItems(facebookItemsForUsers); // Broadcast update to activity Intent intent = new Intent(); intent.setAction(FeedActivity.FEED_UPDATED); Bundle b = new Bundle(); b.putString("feedTitle", feed.getTitle()); intent.putExtras(b); lbm.sendBroadcast(intent); Log.i(TwitterJSONParser.class.getName(), "Time in millis for complete update of feed \"" + feed.getTitle() + "\" facebook items request: " + (System.currentTimeMillis() - time)); } @Override public void onFacebookError(FacebookError e, final Object state) { Log.e("Parse", "Facebook Error:" + e.getMessage()); } @Override public void onFileNotFoundException(FileNotFoundException e, final Object state) { Log.e("Parse", "Resource not found:" + e.getMessage()); } @Override public void onIOException(IOException e, final Object state) { Log.e("Parse", "Network Error:" + e.getMessage()); } @Override public void onMalformedURLException(MalformedURLException e, final Object state) { Log.e("Parse", "Invalid URL:" + e.getMessage()); } }); }
From source file:com.odkclinic.client.PatientList.java
/** * Starts intent for viewing patientdata *///from w w w . ja v a2 s. c om private void patientDetailsIntent(long id) { Intent i = new Intent(this, PatientDetails.class); Bundle extras = new Bundle(); extras.putLong(PatientTable.ID.getName(), id); i.putExtras(extras); startActivityForResult(i, R.layout.patientdetails); }
From source file:gov.wa.wsdot.android.wsdot.ui.FerriesRouteAlertsBulletinsFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); Bundle b = new Bundle(); Intent intent = new Intent(getActivity(), FerriesRouteAlertsBulletinDetailsActivity.class); b.putString("AlertFullTitle", routeAlertItems.get(position).getAlertFullTitle()); b.putString("AlertPublishDate", routeAlertItems.get(position).getPublishDate()); b.putString("AlertDescription", routeAlertItems.get(position).getAlertDescription()); b.putString("AlertFullText", routeAlertItems.get(position).getAlertFullText()); intent.putExtras(b); startActivity(intent);//from w ww . j ava 2 s .c o m }