List of usage examples for android.os Bundle putDouble
public void putDouble(@Nullable String key, double value)
From source file:org.fs.ghanaian.util.JsonUtility.java
private static void putBundleObject(Bundle bundle, String key, Object object) { if (bundle != null && object != null && !TextUtils.isEmpty(key)) { if (object instanceof String) { bundle.putString(key, (String) object); } else if (object instanceof Boolean) { bundle.putBoolean(key, (Boolean) object); } else if (object instanceof Double) { bundle.putDouble(key, (Double) object); } else if (object instanceof Float) { Float value = (Float) object; bundle.putDouble(key, (double) value); } else if (object instanceof Integer) { bundle.putInt(key, (Integer) object); } else if (object instanceof Long) { bundle.putLong(key, (Long) object); } else if (object instanceof JSONObject) { object = parseBundle((JSONObject) object); bundle.putBundle(key, (Bundle) object); } else if (object instanceof JSONArray) { int elementQuantity = ((JSONArray) object).length(); Bundle subBundle = new Bundle(elementQuantity); for (int i = 0; i < elementQuantity; i++) { Object subObject = getArrayValue((JSONArray) object, i, null); if (subObject != null) { putBundleObject(subBundle, key, subObject); }/*from w w w . ja v a 2s .c o m*/ } } } }
From source file:com.mifos.mifosxdroid.online.LoanRepaymentFragment.java
public static LoanRepaymentFragment newInstance(LoanWithAssociations loanWithAssociations) { LoanRepaymentFragment fragment = new LoanRepaymentFragment(); Bundle args = new Bundle(); if (loanWithAssociations != null) { args.putString(Constants.CLIENT_NAME, loanWithAssociations.getClientName()); args.putString(Constants.LOAN_PRODUCT_NAME, loanWithAssociations.getLoanProductName()); args.putString(Constants.LOAN_ACCOUNT_NUMBER, loanWithAssociations.getAccountNo()); args.putDouble(Constants.AMOUNT_IN_ARREARS, loanWithAssociations.getSummary().getTotalOverdue()); //args.putDouble(Constants.AMOUNT_DUE, loanWithAssociations.getSummary() // .getPrincipalDisbursed()); //args.putDouble(Constants.FEES_DUE, loanWithAssociations.getSummary() // .getFeeChargesOutstanding()); fragment.setArguments(args);/*from w ww. jav a2s . c o m*/ } return fragment; }
From source file:com.pdftron.pdf.controls.AddPageDialogFragment.java
public static AddPageDialogFragment newInstance(PageSize currentPageSize, PageType currentPageType, double lastPageWidth, double lastPageHeight, boolean createNewPdf) { AddPageDialogFragment fragment = new AddPageDialogFragment(); Bundle args = new Bundle(); args.putInt(ARG_CURRENT_PAGE_SIZE, currentPageSize.ordinal()); args.putInt(ARG_CURRENT_PAGE_TYPE, currentPageType.ordinal()); args.putDouble(ARG_LAST_PAGE_WIDTH, lastPageWidth / 72); args.putDouble(ARG_LAST_PAGE_HEIGHT, lastPageHeight / 72); args.putBoolean(ARG_CREATE_NEW_PDF, createNewPdf); fragment.setArguments(args);//from w w w. j av a 2 s . co m return fragment; }
From source file:com.sun.inject.Injector.java
public static final void putBundleValue(Bundle outState, String name, Object value) { if (value instanceof Boolean) { outState.putBoolean(name, (Boolean) value); } else if (value instanceof String) { outState.putString(name, (String) value); } else if (value instanceof Integer) { outState.putInt(name, (Integer) value); } else if (value instanceof Parcelable) { outState.putParcelable(name, (Parcelable) value); } else if (value instanceof Float) { outState.putFloat(name, (Float) value); } else if (value instanceof Double) { outState.putDouble(name, (Double) value); }/*from w w w.ja v a2 s.co m*/ }
From source file:uk.org.rivernile.edinburghbustracker.android.fragments.general.BusStopMapFragment.java
/** * Create a new instance of the BusStopMapFragment, setting the initial * location specified by latitude and longitude. * //ww w . ja v a 2 s .co m * @param latitude The latitude to go to. * @param longitude The longitude to go to. * @return A new instance of this Fragment. */ public static BusStopMapFragment newInstance(final double latitude, final double longitude) { final BusStopMapFragment f = new BusStopMapFragment(); final Bundle b = new Bundle(); b.putDouble(ARG_LATITUDE, latitude); b.putDouble(ARG_LONGITUDE, longitude); f.setArguments(b); return f; }
From source file:org.xbmc.kore.ui.sections.video.TVShowDetailsFragment.java
/** * Create a new instance of this, initialized to show tvshowId *///from w w w .ja v a 2 s . c o m @TargetApi(21) public static TVShowDetailsFragment newInstance(TVShowListFragment.ViewHolder vh) { TVShowDetailsFragment fragment = new TVShowDetailsFragment(); Bundle args = new Bundle(); args.putInt(BUNDLE_KEY_TVSHOWID, vh.tvshowId); args.putInt(BUNDLE_KEY_EPISODE, vh.episode); args.putString(BUNDLE_KEY_GENRES, vh.genres); args.putString(BUNDLE_KEY_PLOT, vh.plot); args.putString(BUNDLE_KEY_PREMIERED, vh.premiered); args.putDouble(BUNDLE_KEY_RATING, vh.rating); args.putString(BUNDLE_KEY_STUDIO, vh.studio); args.putString(BUNDLE_KEY_TITLE, vh.tvshowTitle); args.putInt(BUNDLE_KEY_WATCHEDEPISODES, vh.watchedEpisodes); if (Utils.isLollipopOrLater()) { args.putString(POSTER_TRANS_NAME, vh.artView.getTransitionName()); } fragment.setArguments(args); return fragment; }
From source file:org.xbmc.kore.ui.AlbumDetailsFragment.java
/** * Create a new instance of this, initialized to show the album albumId *//*from w w w . jav a 2s .c o m*/ @TargetApi(21) public static AlbumDetailsFragment newInstance(AlbumListFragment.ViewHolder vh) { AlbumDetailsFragment fragment = new AlbumDetailsFragment(); Bundle args = new Bundle(); args.putInt(BUNDLE_KEY_ALBUMID, vh.albumId); args.putString(BUNDLE_KEY_ALBUMTITLE, vh.albumTitle); args.putString(BUNDLE_KEY_ALBUMARTIST, vh.albumArtist); args.putString(BUNDLE_KEY_ALBUMGENRE, vh.albumGenre); args.putInt(BUNDLE_KEY_ALBUMYEAR, vh.albumYear); args.putDouble(BUNDLE_KEY_ALBUMRATING, vh.albumRating); if (Utils.isLollipopOrLater()) { args.putString(POSTER_TRANS_NAME, vh.artView.getTransitionName()); } fragment.setArguments(args); return fragment; }
From source file:org.xbmc.kore.ui.MovieDetailsFragment.java
/** * Create a new instance of this, initialized to show the movie movieId *//*w ww . ja v a 2s.c o m*/ @TargetApi(21) public static MovieDetailsFragment newInstance(MovieListFragment.ViewHolder vh) { MovieDetailsFragment fragment = new MovieDetailsFragment(); Bundle args = new Bundle(); args.putInt(BUNDLE_KEY_MOVIEID, vh.movieId); args.putString(BUNDLE_KEY_MOVIETITLE, vh.movieTitle); args.putString(BUNDLE_KEY_MOVIEPLOT, vh.movieTagline); args.putString(BUNDLE_KEY_MOVIEGENRES, vh.movieGenres); args.putInt(BUNDLE_KEY_MOVIEYEAR, vh.movieYear); args.putInt(BUNDLE_KEY_MOVIERUNTIME, vh.movieRuntime); args.putDouble(BUNDLE_KEY_MOVIERATING, vh.movieRating); if (Utils.isLollipopOrLater()) { args.putString(POSTER_TRANS_NAME, vh.artView.getTransitionName()); } fragment.setArguments(args); return fragment; }
From source file:com.javielinux.fragments.TweetMapFragment.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putDouble(KEY_SAVE_LATITUDE, latitude); outState.putDouble(KEY_SAVE_LONGITUDE, longitude); super.onSaveInstanceState(outState); }
From source file:li.barter.utils.Utils.java
/** * Converts a cursor to a bundle. Field datatypes will be maintained. Floats will be stored in * the Bundle as Doubles, and Integers will be stored as Longs due to Cursor limitationcs * * @param cursor The cursor to convert to a Bundle. This must be positioned to the row to be * read//from ww w . j a va 2 s . c o m * @return The converted bundle */ public static Bundle cursorToBundle(Cursor cursor) { final int columnCount = cursor.getColumnCount(); final Bundle bundle = new Bundle(columnCount); for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) { final String columnName = cursor.getColumnName(columnIndex); switch (cursor.getType(columnIndex)) { case Cursor.FIELD_TYPE_STRING: { bundle.putString(columnName, cursor.getString(columnIndex)); break; } case Cursor.FIELD_TYPE_BLOB: { bundle.putByteArray(columnName, cursor.getBlob(columnIndex)); break; } case Cursor.FIELD_TYPE_FLOAT: { bundle.putDouble(columnName, cursor.getDouble(columnIndex)); break; } case Cursor.FIELD_TYPE_INTEGER: { bundle.putLong(columnName, cursor.getLong(columnIndex)); break; } } } return bundle; }