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:com.lolo.focusdays.speechtotextdemo.location.MyLocationDemoActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putDouble("marker.latitude", markerPosition.latitude);
    outState.putDouble("marker.longitude", markerPosition.longitude);
    if (this.currentLocation != null) {
        outState.putString("currentLocationAddress", this.currentLocation.getAddress());
        outState.putString("currentLocationZip", this.currentLocation.getZip());
        outState.putString("currentLocationCity", this.currentLocation.getCity());
        outState.putString("currentLocationCountry", this.currentLocation.getCountry());
    }/* ww w . j  ava  2  s  .c o  m*/
}

From source file:org.mariotaku.twidere.activity.MapViewerActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.map_viewer);
    final Uri uri = getIntent().getData();
    if (uri == null || !AUTHORITY_MAP.equals(uri.getAuthority())) {
        finish();//from  w w  w .  ja v  a 2 s.  c  o m
        return;
    }
    final Bundle bundle = new Bundle();
    final String param_lat = uri.getQueryParameter(QUERY_PARAM_LAT);
    final String param_lng = uri.getQueryParameter(QUERY_PARAM_LNG);
    if (param_lat == null || param_lng == null) {
        finish();
        return;
    }
    try {
        bundle.putDouble(INTENT_KEY_LATITUDE, Double.valueOf(param_lat));
        bundle.putDouble(INTENT_KEY_LONGITUDE, Double.valueOf(param_lng));
    } catch (final NumberFormatException e) {
        finish();
        return;
    }
    final Fragment fragment = isNativeMapSupported() ? new NativeMapFragment() : new WebMapFragment();
    fragment.setArguments(bundle);
    final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    ft.replace(R.id.map_frame, fragment).commit();
}

From source file:com.openlocationcode.android.main.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle savedInstanceState) {
    CameraPosition currentMapCameraPosition = mMainPresenter.getMapCameraPosition();
    Log.i(TAG, "Saving state");
    if (currentMapCameraPosition != null) {
        savedInstanceState.putDouble(MAP_CAMERA_POSITION_LATITUDE, currentMapCameraPosition.target.latitude);
        savedInstanceState.putDouble(MAP_CAMERA_POSITION_LONGITUDE, currentMapCameraPosition.target.longitude);
        savedInstanceState.putFloat(MAP_CAMERA_POSITION_ZOOM, currentMapCameraPosition.zoom);
    }//from  w w w  .j a v  a2  s .c om

    super.onSaveInstanceState(savedInstanceState);
}

From source file:de.persoapp.android.activity.dialog.AbstractGetResultDialog.java

public T askForResult(final BaseActivitySupport activity, Bundle args) {
    if (Looper.getMainLooper().getThread() == Thread.currentThread()) {
        throw new IllegalThreadStateException("You are on the UI thread!");
    }/* w  ww  . j a  va2  s .c o  m*/

    final double id = Math.random();

    args.putDouble(ID, id);
    setArguments(args);

    mWaiter = new Waiter(id);

    activity.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            activity.showDialog(AbstractGetResultDialog.this, TAG);
        }
    });

    return mWaiter.getResult();
}

From source file:de.vanita5.twittnuker.activity.support.MapViewerActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    final Uri uri = getIntent().getData();
    if (uri == null || !AUTHORITY_MAP.equals(uri.getAuthority())) {
        finish();/*from ww w  .j a v a  2  s .c o  m*/
        return;
    }
    final Bundle bundle = new Bundle();
    final String param_lat = uri.getQueryParameter(QUERY_PARAM_LAT);
    final String param_lng = uri.getQueryParameter(QUERY_PARAM_LNG);
    if (param_lat == null || param_lng == null) {
        finish();
        return;
    }
    try {
        bundle.putDouble(EXTRA_LATITUDE, Double.valueOf(param_lat));
        bundle.putDouble(EXTRA_LONGITUDE, Double.valueOf(param_lng));
    } catch (final NumberFormatException e) {
        finish();
        return;
    }
    final Fragment fragment = isNativeMapSupported() ? new NativeMapFragment() : new WebMapFragment();
    fragment.setArguments(bundle);
    final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    ft.replace(android.R.id.content, fragment).commit();
}

From source file:com.reliqartz.firsttipcalc.gui.CalcFragment.java

public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putDouble(BILL_WITHOUT_TIP, mBillBeforeTip);
    outState.putDouble(CURRENT_TIP, mTipAmount);
    outState.putDouble(TOTAL_BILL, mFinalBill);
    outState.putInt(SEEKBAR_TIP, mTipSeekBar.getProgress());
}

From source file:com.dwdesign.tweetings.activity.MapViewerActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.map_viewer);
    final Uri uri = getIntent().getData();
    if (uri == null || !AUTHORITY_MAP.equals(uri.getAuthority())) {
        finish();//from w ww . jav a2  s. c  o  m
        return;
    }
    final Bundle bundle = new Bundle();
    final String param_lat = uri.getQueryParameter(QUERY_PARAM_LAT);
    final String param_lng = uri.getQueryParameter(QUERY_PARAM_LNG);
    if (param_lat == null || param_lng == null) {
        finish();
        return;
    }
    try {
        bundle.putDouble(INTENT_KEY_LATITUDE, Double.valueOf(param_lat));
        bundle.putDouble(INTENT_KEY_LONGITUDE, Double.valueOf(param_lng));
    } catch (final NumberFormatException e) {
        finish();
        return;
    }
    mFragment = isNativeMapSupported() ? new NativeMapFragment() : new WebMapFragment();
    mFragment.setArguments(bundle);
    final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    ft.replace(R.id.map_frame, mFragment).commit();
}

From source file:planets.position.LunarEclipse.java

private void showEclipseData(int num, boolean local) {
    Bundle bundle = new Bundle();
    bundle.putInt("eclipseNum", num);
    bundle.putDouble("Offset", offset);
    bundle.putBoolean("db", false);
    bundle.putBoolean("local", local);
    Intent i = new Intent(this, EclipseData.class);
    i.putExtras(bundle);/*  ww w  . j  av a 2  s.  c o m*/
    startActivityForResult(i, ECLIPSE_DATA);
}

From source file:com.facebook.InsightsLogger.java

/**
 * Log, or "Fire" a Conversion Pixel.  Conversion Pixels are used for Ads Conversion Tracking.  See
 * https://www.facebook.com/help/435189689870514 to learn more.
 *
 * @param pixelId      Numeric ID for the conversion pixel to be logged.  See
 *                     https://www.facebook.com/help/435189689870514 to learn how to create a conversion pixel.
 * @param valueOfPixel Value of what the logging of this pixel is worth to the calling app.  The currency that this
 *                     is expressed in doesn't matter, so long as it is consistent across all logging for this
 *                     pixel. This value will be rounded to the thousandths place (e.g., 12.34567 becomes 12.346).
 *///from  w  w w  . j  av a  2 s  .  co  m
public void logConversionPixel(String pixelId, double valueOfPixel) {

    if (pixelId == null) {
        notifyDeveloperError("pixelID cannot be null");
        return;
    }

    Bundle parameters = new Bundle();
    parameters.putString(EVENT_PARAMETER_PIXEL_ID, pixelId);
    parameters.putDouble(EVENT_PARAMETER_PIXEL_VALUE, valueOfPixel);

    logEventNow(EVENT_NAME_LOG_CONVERSION_PIXEL, valueOfPixel, parameters);
}

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

/**
 * Makes the submission and pushes it to the server
 *//*from   www.j  a v a 2 s  .  c o  m*/
private void makeSubmission() {
    if (checkFieldsValidity()) {
        Submission newSub = new Submission(getMainActivity(), this.confirmedCategories,
                this.submissionTitle.getText().toString(), this.submissionDescription.getText().toString(),
                this.location);
        newSub.setFile(this.photoFile);
        if (this.currentPhoto != null) {
            newSub.setImage(this.currentPhoto);
        }

        if (newSub.submitToServer()) {
            // fetch the submissions again
            getMainActivity().startService(new Intent(getMainActivity(), SubmissionFetchService.class));
            Log.e(TAG, "makeSubmission: Submission sent succesfully");

            Bundle bundle = new Bundle();
            bundle.putDouble("latitude", this.location.getLatitude());
            bundle.putDouble("longitude", this.location.getLongitude());

            getMainActivity().fragmentSwitcher(Constants.fragmentTypes.FRAGMENT_MAP, bundle);
            getMainActivity().makeToast("Success!");
        } else {
            getMainActivity().makeToast("Error Submitting");
        }
    } else {
        getMainActivity().makeToast("Fields are not valid!");
        Log.e(TAG, "makeSubmission: FIELDS NOT VALID\nFIELDS NOT VALID");
    }
}