List of usage examples for android.os Bundle getDouble
public double getDouble(String key, double defaultValue)
From source file:Main.java
public static double interceptDoubleParam(Bundle savedInstanceState, Intent intent, String paramName) { double ret = 0; if (savedInstanceState != null) { ret = savedInstanceState.getDouble(paramName, 0); } else {/*from ww w. j a v a2s . c om*/ if (intent != null) { Bundle incomming = intent.getExtras(); if (incomming != null) { ret = incomming.getDouble(paramName, 0); } } } return ret; }
From source file:es.usc.citius.servando.calendula.fragments.dosePickers.DosePickerFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle args = getArguments(); initialDose = args.getDouble("dose", 1d); }
From source file:com.dwdesign.tweetings.fragment.WebMapFragment.java
/** * The Location Manager manages location providers. This code searches for * the best provider of data (GPS, WiFi/cell phone tower lookup, some other * mechanism) and finds the last known location. **//* www. j av a 2 s . co m*/ private void getLocation() { final Bundle bundle = getArguments(); if (bundle != null) { latitude = bundle.getDouble(INTENT_KEY_LATITUDE, 0.0); longitude = bundle.getDouble(INTENT_KEY_LONGITUDE, 0.0); } }
From source file:org.mariotaku.twidere.fragment.OpenStreetMapViewerFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(true);// w w w. j a va2 s . c om final Bundle args = getArguments(); final double latitude = args.getDouble(EXTRA_LATITUDE, Double.NaN); final double longitude = args.getDouble(EXTRA_LONGITUDE, Double.NaN); if (Double.isNaN(latitude) || Double.isNaN(longitude)) { getActivity().finish(); return; } mLatitude = latitude; mLongitude = longitude; mMapView.setMultiTouchControls(true); mMapView.setBuiltInZoomControls(true); mMapView.setTilesScaledToDpi(true); final List<Overlay> overlays = mMapView.getOverlays(); final GeoPoint gp = new GeoPoint((int) (latitude * 1E6), (int) (longitude * 1E6)); final Drawable d = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_map_marker, null); final Itemization markers = new Itemization(d, mMapView.getResourceProxy()); final OverlayItem overlayitem = new OverlayItem("", "", gp); markers.addOverlay(overlayitem); overlays.add(markers); final IMapController mc = mMapView.getController(); mc.setZoom(12); mc.setCenter(gp); }
From source file:com.zachrohde.gpsautodash.MainActivity.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); if (savedInstanceState.getDouble("distance", 0) != 0) { GPSService.mDistanceTraveled = savedInstanceState.getDouble("distance"); }/*ww w .j a v a2s . c om*/ }
From source file:org.mariotaku.twidere.fragment.support.GoogleMapFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(true);/* ww w . j a v a2 s .c om*/ final Bundle args = getArguments(); if (args == null || !args.containsKey(EXTRA_LATITUDE) || !args.containsKey(EXTRA_LONGITUDE)) return; final double lat = args.getDouble(EXTRA_LATITUDE, 0.0), lng = args.getDouble(EXTRA_LONGITUDE, 0.0); mMapView = getMap(); final MarkerOptions marker = new MarkerOptions(); marker.position(new LatLng(lat, lng)); mMapView.addMarker(marker); center(false); }
From source file:com.vuw.project1.riverwatch.ui.History_IncidentActivity_Item.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_container); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); }//from w w w .ja va2 s. c o m Bundle extras = getIntent().getExtras(); id = 0; latitude = 0; longitude = 0; if (extras != null) { id = extras.getLong("id", 0); latitude = extras.getDouble("latitude", 0); longitude = extras.getDouble("longitude", 0); } final String[] titles = new String[] { "Info", "Map" }; ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager); viewPager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) { @Override public Fragment getItem(int position) { switch (position) { case 0: return History_IncidentActivityFragment_Info.newInstance(id); case 1: return History_ActivityFragment_Map.newInstance(latitude, longitude); default: return History_IncidentActivityFragment_Info.newInstance(-1); } } @Override public CharSequence getPageTitle(int position) { return titles[position]; } @Override public int getCount() { return titles.length; } }); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout); tabLayout.setupWithViewPager(viewPager); }
From source file:com.vuw.project1.riverwatch.ui.History_WaterActivity_Samples.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_container); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); }// ww w . j a va 2 s. com Bundle extras = getIntent().getExtras(); id = 0; latitude = 0; longitude = 0; if (extras != null) { id = extras.getLong("id", 0); latitude = extras.getDouble("latitude", 0); longitude = extras.getDouble("longitude", 0); } final String[] titles = new String[] { "Samples", "Map", "Graphs" }; ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager); viewPager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) { @Override public Fragment getItem(int position) { switch (position) { case 0: return History_WaterActivityFragment_Samples.newInstance(id); case 1: return History_ActivityFragment_Map.newInstance(latitude, longitude); case 2: return History_WaterActivityFragment_Graph.newInstance(id); default: return History_WaterActivityFragment_Samples.newInstance(-1); } } @Override public CharSequence getPageTitle(int position) { return titles[position]; } @Override public int getCount() { return titles.length; } }); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout); tabLayout.setupWithViewPager(viewPager); }
From source file:com.vuw.project1.riverwatch.ui.History_NitrateActivity_Item.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_container); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); }// w w w .j a v a 2 s.c o m Bundle extras = getIntent().getExtras(); id = 0; latitude = 0; longitude = 0; if (extras != null) { id = extras.getLong("id", 0); latitude = extras.getDouble("latitude", 0); longitude = extras.getDouble("longitude", 0); } final String[] titles = new String[] { "Info", "Map" }; ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager); viewPager.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) { @Override public Fragment getItem(int position) { switch (position) { case 0: return History_NitrateActivityFragment_Info.newInstance(id); case 1: return History_ActivityFragment_Map.newInstance(latitude, longitude); default: return History_NitrateActivityFragment_Info.newInstance(-1); } } @Override public CharSequence getPageTitle(int position) { return titles[position]; } @Override public int getCount() { return titles.length; } }); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout); tabLayout.setupWithViewPager(viewPager); }
From source file:org.mariotaku.twidere.fragment.GoogleMapFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(true);/*from w w w . j a v a 2 s . com*/ final Bundle args = getArguments(); if (args == null || !args.containsKey(EXTRA_LATITUDE) || !args.containsKey(EXTRA_LONGITUDE)) return; final double lat = args.getDouble(EXTRA_LATITUDE, 0.0), lng = args.getDouble(EXTRA_LONGITUDE, 0.0); getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(GoogleMap googleMap) { mMapView = googleMap; final MarkerOptions marker = new MarkerOptions(); marker.position(new LatLng(lat, lng)); mMapView.addMarker(marker); center(false); } }); }