Example usage for android.os Bundle putDouble

List of usage examples for android.os Bundle putDouble

Introduction

In this page you can find the example usage for android.os Bundle putDouble.

Prototype

public void putDouble(@Nullable String key, double value) 

Source Link

Document

Inserts a double value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:uk.org.rivernile.edinburghbustracker.android.fragments.general.NearestStopsFragment.java

/**
 * Cause the data to refresh. The refresh happens asynchronously in another
 * thread./* w w w .ja va 2s.c o  m*/
 * 
 * @param isFirst Is this the first load?
 */
private void doUpdate(final boolean isFirst) {
    if (lastLocation == null)
        return;

    // Stuff the arguments Bundle.
    final Bundle args = new Bundle();
    args.putDouble(NearestStopsLoader.ARG_LATITUDE, lastLocation.getLatitude());
    args.putDouble(NearestStopsLoader.ARG_LONGITUDE, lastLocation.getLongitude());

    // Only put this argument in if chosen services exist.
    if (chosenServices != null && chosenServices.length > 0)
        args.putStringArray(NearestStopsLoader.ARG_FILTERED_SERVICES, chosenServices);

    if (isFirst) {
        getLoaderManager().initLoader(0, args, this);
    } else {
        getLoaderManager().restartLoader(0, args, this);
    }
}

From source file:org.y20k.trackbook.MainActivityMapFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putBoolean(INSTANCE_FIRST_START, mFirstStart);
    outState.putBoolean(INSTANCE_TRACKING_STATE, mTrackerServiceRunning);
    outState.putParcelable(INSTANCE_CURRENT_LOCATION, mCurrentBestLocation);
    outState.putDouble(INSTANCE_LATITUDE_MAIN_MAP, mMapView.getMapCenter().getLatitude());
    outState.putDouble(INSTANCE_LONGITUDE_MAIN_MAP, mMapView.getMapCenter().getLongitude());
    outState.putInt(INSTANCE_ZOOM_LEVEL_MAIN_MAP, mMapView.getZoomLevel());
    outState.putParcelable(INSTANCE_TRACK_MAIN_MAP, mTrack);
    super.onSaveInstanceState(outState);
}

From source file:ca.mudar.mtlaucasou.BaseMapActivity.java

/**
 * This runnable thread gets the Geocode search value in the background
 * (front activity is the Processing dialog). Results are sent to the
 * handler./*from   w  w w. j  a  va  2s  .  c o  m*/
 */
@Override
public void run() {

    Location loc = null;
    try {
        /**
         * Geocode search. Takes time and not very reliable!
         */
        loc = Helper.findLocatioFromName(getApplicationContext(), postalCode);
    } catch (IOException e) {
        Log.e(TAG, e.getMessage());
    }

    Message msg = handler.obtainMessage();
    Bundle b = new Bundle();

    if (loc == null) {
        /**
         * Send error message to handler.
         */
        b.putInt(Const.KEY_BUNDLE_SEARCH_ADDRESS, Const.BUNDLE_SEARCH_ADDRESS_ERROR);
    } else {
        /**
         * Send success message to handler with the found geocoordinates.
         */
        b.putInt(Const.KEY_BUNDLE_SEARCH_ADDRESS, Const.BUNDLE_SEARCH_ADDRESS_SUCCESS);
        b.putDouble(Const.KEY_BUNDLE_ADDRESS_LAT, loc.getLatitude());
        b.putDouble(Const.KEY_BUNDLE_ADDRESS_LNG, loc.getLongitude());
    }
    msg.setData(b);

    handler.sendMessage(msg);
}

From source file:de.j4velin.mapsmeasure.Map.java

@Override
protected void onSaveInstanceState(final Bundle outState) {
    outState.putSerializable("trace", trace);
    outState.putBoolean("metric", metric);
    if (mMap != null) { // might be null if there is an issue with Google
        // Play Services
        outState.putDouble("position-lon", mMap.getCameraPosition().target.longitude);
        outState.putDouble("position-lat", mMap.getCameraPosition().target.latitude);
        outState.putFloat("position-zoom", mMap.getCameraPosition().zoom);
    }//from  w  ww .j a v  a  2  s  .  co  m
    super.onSaveInstanceState(outState);
}

From source file:com.rappsantiago.weighttracker.profile.setup.WeightHeightFragment.java

@Override
public Bundle getProfileData() {
    Bundle data = new Bundle();

    String strWeight = mTxtWeightWrapper.getEditText().getText().toString();
    double weight = Util.parseDouble(strWeight, 0.0);
    String weightUnit = getWeightUnit();

    String strBodyFatIndex = mTxtBodyFatIndexWrapper.getEditText().getText().toString();
    double bodyFatIndex = Util.parseDouble(strBodyFatIndex, 0.0);

    String strHeight = mTxtHeightWrapper.getEditText().getText().toString();
    double height = Util.parseDouble(strHeight, 0.0);

    String strHeightInches = mTxtHeightInchesWrapper.getEditText().getText().toString();
    double heightInches = Util.parseDouble(strHeightInches, 0.0);

    String heightUnit = getHeightUnit();

    data.putDouble(KEY_WEIGHT, weight);
    data.putString(KEY_WEIGHT_UNIT, weightUnit);

    data.putDouble(KEY_BODY_FAT_INDEX, bodyFatIndex);

    data.putDouble(KEY_HEIGHT, height);//from   w w w  .j av  a  2s . c om
    if (heightUnit.equals(Profile.HEIGHT_UNIT_FOOT_INCHES)) {
        data.putDouble(KEY_HEIGHT_INCHES, heightInches);
    }
    data.putString(KEY_HEIGHT_UNIT, heightUnit);

    return data;
}

From source file:org.hfoss.posit.android.functionplugin.reminder.SetReminder.java

/**
 * Invoked when the Reminder plugin is selected from the FindActivity menu. Used
 * here to retrieve the Find's lat, long, and date from the FindActivity view.
 * /*from   w w w .  j av  a2s . c o  m*/
 * @param context, the calling Activity
 * @param find, the current Find
 * @param view, the FindActivity's content view
 * @param intent, the Intent that is passed to the menu activity
 */
public void menuItemSelectedCallback(Context context, Find find, View view, Intent intent) {
    Bundle bundle = new Bundle();
    TextView tv = (TextView) view.findViewById(R.id.timeValueTextView);
    bundle.putString("Date", tv.getText().toString());

    tv = (TextView) view.findViewById(R.id.longitudeValueTextView);
    bundle.putDouble("FindsLongitude", Double.parseDouble(tv.getText().toString()));
    tv = (TextView) view.findViewById(R.id.latitudeValueTextView);
    bundle.putDouble("FindsLatitude", Double.parseDouble(tv.getText().toString()));
    intent.putExtras(bundle);
}

From source file:com.luke.lukef.lukeapp.fragments.MapViewFragment.java

/**
 * Creates a {@link Bundle} object with doubles longitude, latitude and altitude.
 *
 * @param location Location object from which longitude, latitude and altitude are fetched
 *                 to be placed in the Bundle.
 * @return Bundle with double type values longitude, latitude and altitude.
 *///from  w w  w  .ja  v a2s .  c o m
private Bundle constructBundle(Location location) {
    Bundle bundle = new Bundle();
    bundle.putDouble("latitude", location.getLatitude());
    bundle.putDouble("longitude", location.getLongitude());
    bundle.putDouble("altitude", location.getAltitude());
    return bundle;
}

From source file:ru.neverdark.phototools.fragments.SunsetFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    Log.message("Enter");
    super.onSaveInstanceState(outState);
    outState.putDouble(Constants.LOCATION_LATITUDE, mLatitude);
    outState.putDouble(Constants.LOCATION_LONGITUDE, mLongitude);
    outState.putLong(Constants.LOCATION_SELECTION_ID, mSelectionId);
    Log.variable("mSelectionId", String.valueOf(mSelectionId));

    if (mTimeZone != null) {
        outState.putString(Constants.LOCATION_TIMEZONE, mTimeZone.getID());
    }//from   w w w  . j  a va  2 s.  co  m

    outState.putBoolean(Constants.LOCATION_IS_VISIVLE_RESULT, mIsVisibleResult);
    outState.putString(Constants.LOCATION_ASTRO_SUNRISE, mAstroSunrise);
    outState.putString(Constants.LOCATION_ASTRO_SUNSET, mAstroSunset);
    outState.putString(Constants.LOCATION_CIVIL_SUNRISE, mCivilSunrise);
    outState.putString(Constants.LOCATION_CIVIL_SUNSET, mCivilSunset);
    outState.putString(Constants.LOCATION_NAUTICAL_SUNRISE, mNauticalSunrise);
    outState.putString(Constants.LOCATION_NAUTICAL_SUNSET, mNauticalSunset);
    outState.putString(Constants.LOCATION_OFFICIAL_SUNRISE, mOfficialSunrise);
    outState.putString(Constants.LOCATION_OFFICIAL_SUNSET, mOfficialSunset);
    outState.putString(Constants.LOCATION_NAME_DATA, mLocationName);
}

From source file:com.zainsoft.ramzantimetable.QiblaActivity.java

private TimerTask getTimerTask() {
    TimerTask timerTask = new TimerTask() {
        @Override/*w  w w  .  ja  va 2s  .  c  o  m*/
        public void run() {

            if (angleSignaled && !ConcurrencyUtil.isAnyAnimationOnRun()) {

                // numAnimationOnRun += 2;
                Map<String, Double> newAnglesMap = qiblaManager.fetchDeltaAngles();
                Double newNorthAngle = newAnglesMap.get(QiblaCompassManager.NORTH_CHANGED_MAP_KEY);
                Double newQiblaAngle = newAnglesMap.get(QiblaCompassManager.QIBLA_CHANGED_MAP_KEY);

                Message message = mHandler.obtainMessage();
                message.what = ROTATE_IMAGES_MESSAGE;
                Bundle b = new Bundle();
                if (newNorthAngle == null) {
                    b.putBoolean(IS_COMPASS_CHANGED, false);
                } else {
                    ConcurrencyUtil.incrementAnimation();
                    b.putBoolean(IS_COMPASS_CHANGED, true);

                    b.putDouble(COMPASS_BUNDLE_DELTA_KEY, newNorthAngle);
                }
                if (newQiblaAngle == null) {
                    b.putBoolean(IS_QIBLA_CHANGED, false);

                } else {
                    ConcurrencyUtil.incrementAnimation();
                    b.putBoolean(IS_QIBLA_CHANGED, true);
                    b.putDouble(QIBLA_BUNDLE_DELTA_KEY, newQiblaAngle);
                }

                message.setData(b);
                mHandler.sendMessage(message);
            } else if (ConcurrencyUtil.getNumAimationsOnRun() < 0) {
                Log.d(NAMAZ_LOG_TAG, " Number of animations are negetive numOfAnimation: "
                        + ConcurrencyUtil.getNumAimationsOnRun());
            }
        }
    };
    return timerTask;
}

From source file:com.group7.dragonwars.GameActivity.java

public final void endGame() {
    setContentView(R.layout.loading_screen);
    Intent intent = new Intent(this, Results.class);
    Bundle b = new Bundle();
    b.putString("winnerName", state.getWinner().getName());
    b.putInt("turns", state.getTurns());
    Statistics stats = state.getStatistics();
    Double damageDealt = stats.getStatistic("Damage dealt");
    Double damageReceived = stats.getStatistic("Damage received");
    Double distanceTravelled = stats.getStatistic("Distance travelled");
    Integer goldCollected = stats.getStatistic("Gold received").intValue();
    Integer unitsKilled = stats.getStatistic("Units killed").intValue();
    Integer unitsMade = stats.getStatistic("Units produced").intValue();

    Database db = new Database(getApplicationContext());
    db.AddEntry(damageDealt, damageReceived, distanceTravelled, goldCollected, unitsKilled, unitsMade);
    db.Close();// ww w  .  j a va 2  s.  c  om

    for (Map.Entry<String, Double> ent : stats.getEntrySet()) {
        b.putDouble(ent.getKey(), ent.getValue().doubleValue());
    }

    intent.putExtras(b);
    startActivity(intent);
    finish();
}