Example usage for android.os Bundle getDouble

List of usage examples for android.os Bundle getDouble

Introduction

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

Prototype

public double getDouble(String key) 

Source Link

Document

Returns the value associated with the given key, or 0.0 if no mapping of the desired type exists for the given key.

Usage

From source file:de.busse_apps.hmintpmd.gui.ResultFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);//from   w  w w.j ava  2s  .c o m

    Bundle args = getArguments();
    if (args != null) {
        mCalcValue = args.getDouble(ARGUMENT_VALUE);
    }
}

From source file:com.example.gveapp.WeatherActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_weather);
    String city = "London,UK";

    cityText = (TextView) findViewById(R.id.cityText);
    condDescr = (TextView) findViewById(R.id.condDescr);
    temp = (TextView) findViewById(R.id.temp);
    hum = (TextView) findViewById(R.id.hum);
    press = (TextView) findViewById(R.id.press);
    windSpeed = (TextView) findViewById(R.id.windSpeed);
    windDeg = (TextView) findViewById(R.id.windDeg);
    imgView = (ImageView) findViewById(R.id.condIcon);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        // Get data via the key
        double Lat = extras.getDouble("Latitude");
        // if (Lat != null)
        {/*ww w .j  a v a  2 s  .  c  om*/
            m_dLat = Lat;
        }

        double Lon = extras.getDouble("Longitude");
        // if (Lon != null)
        {
            m_dLon = Lon;
        }
    }

    // double lat = m_dLat;
    // double lon = m_dLon;
    JSONWeatherTask task = new JSONWeatherTask();
    task.execute(new String[] { m_dLat + "", m_dLon + "" });
}

From source file:com.example.pavle92.riddlequizapp.ARSimple.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_model3d);

    kontekst = getApplicationContext();//from  w w  w .  j av  a2s.com
    Bundle bnd = getIntent().getExtras();
    lat = bnd.getDouble("lat");
    log = bnd.getDouble("log");

    SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
    userName = settings.getString("UserName", "");

    //assets
    AssetHelper assetHelper = new AssetHelper(getAssets());
    assetHelper.cacheAssetFolder(getApplicationContext(), "Data");

    mainLayout = (FrameLayout) this.findViewById(R.id.mainLayout);

    if (!checkCameraPermission()) {
        //if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) { //ASK EVERY TIME - it's essential!
        ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA },
                MY_PERMISSIONS_REQUEST_CAMERA);
    }

    // When the screen is tapped, inform the renderer and vibrate the phone
    mainLayout.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

            simpleRenderer.click();

            Vibrator vib = (Vibrator) getSystemService(VIBRATOR_SERVICE);
            vib.vibrate(40);

            //                    Toast.makeText(this,marker.getTitle(),Toast.LENGTH_SHORT).show();

            Thread t1 = new Thread(new Runnable() {
                @Override
                public void run() {

                    Intent in = new Intent(ARSimple.this, AnswerBox.class);

                    Place nearest = MyPlacesHTTPHelper.getNearestPlace(lat, log);
                    in.putExtra("lat", Double.valueOf(nearest.getLatitude()));
                    in.putExtra("log", Double.valueOf(nearest.getLongitude()));
                    in.putExtra("riddleQuestionAnsw",
                            nearest.getRidle() + "&" + nearest.getHint() + "&" + nearest.getSolution());
                    in.putExtra("userName", userName);
                    in.putExtra("userNameQ", "RiddleQuizTeam");
                    Log.e("QQQQ", "RiddleQuizTeam");
                    startActivityForResult(in, 9890);
                }
            });
            t1.start();

            try {
                t1.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }

    });
}

From source file:com.nearnotes.NoteList.java

@Override
public void onStart() {
    super.onStart();

    mCallback.setActionItems(NOTE_LIST);
    mSelectedIds = new ArrayList<Long>();
    mDbHelper = new NotesDbAdapter(getActivity()); // Create new custom database class for sqlite and pass the current context as a variable
    mDbHelper.open(); // Gets the writable database

    Bundle bundle = getArguments();
    mLongitude = bundle.getDouble("longitude");
    mLatitude = bundle.getDouble("latitude");
    fillData(mLongitude, mLatitude);// www. j a v  a 2 s.  com
    mListView = getListView();

    getListView().setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE_MODAL);

    getListView().setMultiChoiceModeListener(new MultiChoiceModeListener() {

        private int nr = 0;

        @Override
        public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
            return false;
        }

        @Override
        public void onDestroyActionMode(ActionMode mode) {
            mActionModeFlag = false;
            Log.e("onDestroyActionMode", "onDestroyActionMode");
            mAdapter.clearSelection();
        }

        @Override
        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            mActionModeFlag = true;

            nr = 0;
            MenuInflater inflater = getActivity().getMenuInflater();
            inflater.inflate(R.menu.contextual_menu, menu);
            return true;
        }

        @Override
        public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
            switch (item.getItemId()) {

            case R.id.context_delete:
                for (Long s : mSelectedIds) {
                    mDbHelper.deleteNote(s);
                    if (mDbHelper.fetchSetting() == s) {
                        mDbHelper.removeSetting();
                    }
                }
                nr = 0;
                mAdapter.clearSelection();
                fillData(mLongitude, mLatitude);
                mode.finish();

                return true;
            case R.id.context_select_all:
                SparseBooleanArray checkSparse = getListView().getCheckedItemPositions();
                for (int i = 0; i < mListView.getCount(); i++) {
                    if (!checkSparse.get(i)) {
                        getListView().setItemChecked(i, true);

                    }
                }
                return true;
            }
            return false;
        }

        @Override
        public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
            Log.e("checked", String.valueOf(checked) + " id: " + String.valueOf(id) + " position: "
                    + String.valueOf(position));
            if (checked) {
                nr++;
                mSelectedIds.add(id);
                mAdapter.setNewSelection(position, checked);
            } else {
                mSelectedIds.remove(id);
                nr--;
                mAdapter.removeSelection(position);
            }

            TextView tv = (TextView) getActivity().getLayoutInflater().inflate(R.layout.contextual_title, null);
            tv.setText(nr + " selected");
            mode.setCustomView(tv);

        }
    });

    getListView().setOnItemLongClickListener(new OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int position, long arg3) {

            getListView().setItemChecked(position, !mAdapter.isPositionChecked(position));
            return false;
        }
    });

}

From source file:com.androzic.waypoint.WaypointDetails.java

public void setWaypoint(Waypoint waypoint) {
    this.waypoint = waypoint;

    if (isVisible()) {
        Bundle args = getArguments();
        double lat = args != null ? args.getDouble("lat") : waypoint.latitude;
        double lon = args != null ? args.getDouble("lon") : waypoint.longitude;
        updateWaypointDetails(lat, lon);
    }/*w w  w  . j a v a  2 s.  co  m*/
}

From source file:com.androzic.waypoint.WaypointDetails.java

@Override
public void onStart() {
    super.onStart();

    if (waypoint != null) {
        Bundle args = getArguments();
        double lat = args != null ? args.getDouble("lat") : waypoint.latitude;
        double lon = args != null ? args.getDouble("lon") : waypoint.longitude;
        updateWaypointDetails(lat, lon);
    }/*from   w  ww  .jav a2 s.c om*/
}

From source file:com.github.matt.williams.blook8r.MapActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ground_overlay_demo);

    mTransparencyBar = (SeekBar) findViewById(R.id.transparencySeekBar);
    mTransparencyBar.setMax(TRANSPARENCY_MAX);
    mTransparencyBar.setProgress(0);/*from w  w w .  j av  a2  s.  co  m*/

    mTransparencyBar.setVisibility(View.GONE);
    findViewById(R.id.transparencyTitle).setVisibility(mTransparencyBar.getVisibility());

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        if (extras.containsKey("latitude")) {
            mLatitude = extras.getDouble("latitude");
            mLongitude = extras.getDouble("longitude");
        }
        mDescription = extras.getString("description");
    }

    setUpMapIfNeeded();
}

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

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    Log.i(TAG, "Restoring state");
    if (savedInstanceState != null) {
        double mapCameraPositionLatitude = savedInstanceState.getDouble(MAP_CAMERA_POSITION_LATITUDE);
        double mapCameraPositionLongitude = savedInstanceState.getDouble(MAP_CAMERA_POSITION_LONGITUDE);
        float mapCameraPositionZoom = savedInstanceState.getFloat(MAP_CAMERA_POSITION_ZOOM);
        mMainPresenter.setMapCameraPosition(mapCameraPositionLatitude, mapCameraPositionLongitude,
                mapCameraPositionZoom);//from   ww  w. j ava  2 s  .c  om
    }
}

From source file:com.spoiledmilk.cykelsuperstier.navigation.SMRouteNavigationActivity.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == BreakRouteActivity.RESULT_ROUTE_BROKEN) {
        if (data != null && data.getExtras() != null) {
            Bundle args = data.getExtras();
            startStat = Util.locationFromCoordinates(args.getDouble("start_station_lat"),
                    args.getDouble("start_station_lon"));
            endStat = Util.locationFromCoordinates(args.getDouble("end_station_lat"),
                    args.getDouble("end_station_lon"));
            aStationName = args.getString("start_stat_name");
            bStationName = args.getString("end_stat_name");
            distance = args.getDouble("distance");
            stationIconId = args.getInt("iconId");
            getMapFragment().jsonRoot = null;
            List<Location> viaList = new LinkedList<Location>();
            viaList.add(startStat);/*from   www . j av  a  2 s  .  c om*/
            viaList.add(endStat);
            new SMHttpRequest().getRoute(getMapFragment().startLocation, getMapFragment().endLocation, viaList,
                    this);
        }
    }
}

From source file:com.example.gps_project.Places.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    location = new JSONObject();

    setContentView(R.layout.places_list);

    Bundle extras = getIntent().getExtras();
    double a, b;//ww  w . j a  v a  2  s.c  o m
    //get the bundle
    LATITUDE = extras.getDouble("Latitude");
    LONGITUDE = extras.getDouble("Longitude");
    params.putString("Start", extras.getString("Start"));
    params.putString("End", extras.getString("End"));
    session = Session.openActiveSessionWithAccessToken(Places.this,
            AccessToken.createFromExistingAccessToken(extras.getString("accesstoken"), null, null, null, null),
            new Session.StatusCallback() {

                @Override
                public void call(Session session, SessionState state, Exception exception) {
                    // TODO Auto-generated method stub

                }
            });
    fetchPlaces();
}