List of usage examples for android.os Bundle getDouble
public double getDouble(String key)
From source file:org.klnusbaum.udj.containers.Player.java
public static Player unbundle(Bundle toUnbundle) { return new Player(toUnbundle.getString(ID_PARAM), toUnbundle.getString(NAME_PARAM), User.unbundle(toUnbundle.getBundle(OWNER_PARAM)), toUnbundle.getDouble(LATITUDE_PARAM), toUnbundle.getDouble(LONGITUDE_PARAM), toUnbundle.getBoolean(HAS_PASSWORD_PARAM)); }
From source file:com.vuw.project1.riverwatch.colour_algorithm.InfoFragment.java
public void setNitrateNitrite(Bundle result) { Double nitrate = result.getDouble("nitrate"); Double nitrite = result.getDouble("nitrite"); // set text views to nitrite and nitrate levels DecimalFormat df = new DecimalFormat("#.##"); df.setRoundingMode(RoundingMode.CEILING); nitrateTextView.setText("Nitrate: " + df.format(nitrate)); nitriteTextView.setText("Nitrite: " + df.format(nitrite)); }
From source file:com.example.edwin.car2charge.DetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext()); if (status != ConnectionResult.SUCCESS) Toast.makeText(getApplicationContext(), "No Google Play", Toast.LENGTH_LONG).show(); setContentView(R.layout.detailactivity); map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); setTitle(R.string.detail);/*from ww w.j a va 2 s . c o m*/ Bundle extras = getIntent().getExtras(); if (extras != null) { double lat = extras.getDouble("lat"); double lng = extras.getDouble("long"); String license = extras.getString("license"); String address = extras.getString("address"); String battery = extras.getString("battery"); //Toast.makeText(this, "lat: " + lat + " long: " + lng, Toast.LENGTH_LONG).show(); latLong = new LatLng(lat, lng); CameraPosition cameraPosition = new CameraPosition.Builder().target(latLong).zoom(16f).build(); CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(cameraPosition); map.animateCamera(cameraUpdate); Marker car = map.addMarker(new MarkerOptions().position(latLong).title(license + " (" + battery + "%)") .snippet(address).icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_car))); car.showInfoWindow(); map.setMyLocationEnabled(true); } }
From source file:eu.geopaparazzi.library.core.dialogs.NoteDialogFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle arguments = getArguments(); latitude = arguments.getDouble(LATITUDE); longitude = arguments.getDouble(LONGITUDE); elevation = arguments.getDouble(ELEVATION); }
From source file:com.fenlisproject.elf.core.framework.ElfBinder.java
public static void bindFragmentArgument(Fragment receiver) { Field[] fields = receiver.getClass().getDeclaredFields(); for (Field field : fields) { field.setAccessible(true);//w w w .j a va2s. co m FragmentArgument fragmentArgument = field.getAnnotation(FragmentArgument.class); if (fragmentArgument != null) { try { Bundle bundle = receiver.getArguments(); if (bundle != null) { Class<?> type = field.getType(); if (type == Boolean.class || type == boolean.class) { field.set(receiver, bundle.getBoolean(fragmentArgument.value())); } else if (type == Byte.class || type == byte.class) { field.set(receiver, bundle.getByte(fragmentArgument.value())); } else if (type == Character.class || type == char.class) { field.set(receiver, bundle.getChar(fragmentArgument.value())); } else if (type == Double.class || type == double.class) { field.set(receiver, bundle.getDouble(fragmentArgument.value())); } else if (type == Float.class || type == float.class) { field.set(receiver, bundle.getFloat(fragmentArgument.value())); } else if (type == Integer.class || type == int.class) { field.set(receiver, bundle.getInt(fragmentArgument.value())); } else if (type == Long.class || type == long.class) { field.set(receiver, bundle.getLong(fragmentArgument.value())); } else if (type == Short.class || type == short.class) { field.set(receiver, bundle.getShort(fragmentArgument.value())); } else if (type == String.class) { field.set(receiver, bundle.getString(fragmentArgument.value())); } else if (type == Boolean[].class || type == boolean[].class) { field.set(receiver, bundle.getBooleanArray(fragmentArgument.value())); } else if (type == Byte[].class || type == byte[].class) { field.set(receiver, bundle.getByteArray(fragmentArgument.value())); } else if (type == Character[].class || type == char[].class) { field.set(receiver, bundle.getCharArray(fragmentArgument.value())); } else if (type == Double[].class || type == double[].class) { field.set(receiver, bundle.getDoubleArray(fragmentArgument.value())); } else if (type == Float[].class || type == float[].class) { field.set(receiver, bundle.getFloatArray(fragmentArgument.value())); } else if (type == Integer[].class || type == int[].class) { field.set(receiver, bundle.getIntArray(fragmentArgument.value())); } else if (type == Long[].class || type == long[].class) { field.set(receiver, bundle.getLongArray(fragmentArgument.value())); } else if (type == Short[].class || type == short[].class) { field.set(receiver, bundle.getShortArray(fragmentArgument.value())); } else if (type == String[].class) { field.set(receiver, bundle.getStringArray(fragmentArgument.value())); } else if (Serializable.class.isAssignableFrom(type)) { field.set(receiver, bundle.getSerializable(fragmentArgument.value())); } else if (type == Bundle.class) { field.set(receiver, bundle.getBundle(fragmentArgument.value())); } } } catch (IllegalAccessException e) { e.printStackTrace(); } } } }
From source file:name.gumartinm.weather.information.fragment.map.MapProgressFragment.java
/** * This method will only be called once when the retained * Fragment is first created./*from w w w . j a v a 2 s . c o m*/ */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Retain this fragment across configuration changes. this.setRetainInstance(true); final Bundle bundle = this.getArguments(); double latitude = bundle.getDouble("latitude"); double longitude = bundle.getDouble("longitude"); // Create and execute the background task. new GetAddressTask(this.getActivity().getApplicationContext()).execute(latitude, longitude); }
From source file:com.androzic.waypoint.CoordinatesReceived.java
@NonNull @SuppressLint("InflateParams") @Override/*w w w .ja v a2s . c om*/ public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getString(R.string.information_name)); View view = getActivity().getLayoutInflater().inflate(R.layout.dlg_coordinates_received, null); builder.setView(view); builder.setPositiveButton(R.string.menu_visible, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Androzic application = Androzic.getApplication(); application.ensureVisible(lat, lon); CoordinatesReceived.this.dismiss(); } }); Bundle args = getArguments(); String title = args.getString("title"); String sender = args.getString("sender"); lat = args.getDouble("lat"); lon = args.getDouble("lon"); if (!"".equals(title)) builder.setTitle(title); else builder.setTitle(R.string.coordinates_name); Androzic application = Androzic.getApplication(); double[] ll = application.getLocation(); ((TextView) view.findViewById(R.id.message)).setText(getString(R.string.new_coordinates, sender)); String coords = StringFormatter.coordinates(" ", lat, lon); ((TextView) view.findViewById(R.id.coordinates)).setText(coords); double dist = Geo.distance(ll[0], ll[1], lat, lon); double bearing = Geo.bearing(ll[0], ll[1], lat, lon); bearing = application.fixDeclination(bearing); String distance = StringFormatter.distanceH(dist) + " " + StringFormatter.angleH(bearing); ((TextView) view.findViewById(R.id.distance)).setText(distance); return builder.create(); }
From source file:com.javielinux.fragments.TweetMapFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null && savedInstanceState.containsKey(KEY_SAVE_LATITUDE)) { init(savedInstanceState.getDouble(KEY_SAVE_LATITUDE), savedInstanceState.getDouble(KEY_SAVE_LONGITUDE)); }/* www .j a va 2s . c o m*/ }
From source file:com.kyloth.serleena.sensors.BackgroundLocationManager.java
/** * Implementa ServiceResultReceiver.Receiver.onReceiveResult(). * * Viene utilizzato dal servizio avviato per segnalare i risultati * relativi alla posizione utente. Questi dati vengono segnalari poi agli * observer.//from ww w . j av a 2 s. c om * * @param resultCode Codice del risultato. * @param resultData Dati del risultato. */ @Override public void onReceiveResult(int resultCode, Bundle resultData) { this.location = new GeoPoint(resultData.getDouble("latitude"), resultData.getDouble("longitude")); notifyObservers(); }
From source file:com.androzic.waypoint.WaypointInfo.java
@Override public void onStart() { super.onStart(); Bundle args = getArguments(); if (args != null) { double lat = args.getDouble("lat"); double lon = args.getDouble("lon"); updateWaypointInfo(lat, lon);//from w ww . jav a 2 s .c o m } }