List of usage examples for android.os Bundle getDouble
public double getDouble(String key)
From source file:com.luke.lukef.lukeapp.fragments.NewSubmissionFragment.java
/** * Fetches the location from the bundle/*from w ww .ja v a 2 s. c o m*/ */ private void fetchBundleFromArguments() { Bundle b = getArguments(); // getMainActivity().getIntent().getExtras(); if (b != null) { this.location = new Location("jes"); this.location.setLatitude(b.getDouble("latitude")); this.location.setLongitude(b.getDouble("longitude")); this.location.setAltitude(b.getDouble("altitude")); Log.e(TAG, "onCreateView: bundle received: " + location.toString()); } }
From source file:can.yrt.onebusaway.map.StopsRequest.java
@Override public void setState(Bundle args) { if (args != null) { Location center = null;/* w ww .j ava 2 s.c om*/ float mapZoom = args.getFloat(MapParams.ZOOM, MapParams.DEFAULT_ZOOM); double lat = args.getDouble(MapParams.CENTER_LAT); double lon = args.getDouble(MapParams.CENTER_LON); if (lat != 0.0 && lon != 0.0) { center = LocationHelp.makeLocation(lat, lon); } mFragment.getMapView().setZoom((float) mapZoom); if (center != null) { mFragment.getMapView().setMapCenter(center); onLocation(); } else { mFragment.setMyLocation(); } } else { mFragment.setMyLocation(); } }
From source file:eu.geopaparazzi.library.forms.FormActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // make sure the orientation can't be changed once this activity started int currentOrientation = getResources().getConfiguration().orientation; if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else {/* ww w. ja v a 2 s.c o m*/ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } Bundle extras = getIntent().getExtras(); if (extras != null) { sectionName = extras.getString(LibraryConstants.PREFS_KEY_FORM_NAME); sectionObjectString = extras.getString(LibraryConstants.PREFS_KEY_FORM_JSON); latitude = extras.getDouble(LibraryConstants.LATITUDE); longitude = extras.getDouble(LibraryConstants.LONGITUDE); elevation = extras.getDouble(LibraryConstants.ELEVATION); noteId = extras.getLong(LibraryConstants.DATABASE_ID); } try { if (sectionObjectString == null) { sectionObject = TagsManager.getInstance(this).getSectionByName(sectionName); // copy the section object, which will be kept around along the activity sectionObjectString = sectionObject.toString(); } sectionObject = new JSONObject(sectionObjectString); formNames4Section = TagsManager.getFormNames4Section(sectionObject); } catch (Exception e) { e.printStackTrace(); } setContentView(R.layout.form); }
From source file:name.gumartinm.weather.information.activity.MapActivity.java
/** * I am not using fragment transactions in the right way. But I do not know other way for doing what I am doing. * /* w w w. j ava 2s.co m*/ * {@link http://stackoverflow.com/questions/16265733/failure-delivering-result-onactivityforresult} */ @Override public void onPostResume() { super.onPostResume(); final FragmentManager fm = getSupportFragmentManager(); final Fragment progressFragment = fm.findFragmentByTag(PROGRESS_FRAGMENT_TAG); if (progressFragment == null) { this.addButtonsFragment(); } else { this.removeProgressFragment(); final Bundle bundle = progressFragment.getArguments(); double latitude = bundle.getDouble("latitude"); double longitude = bundle.getDouble("longitude"); this.addProgressFragment(latitude, longitude); } }
From source file:jp.co.tweetmap.Fragment0.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (LogUtil.isDebug()) Log.e(TAG, "### requestCode : " + requestCode); if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case MapUtil.REQUEST_CODE_FRAGMENT_0: // Called form StationSearchActivity Bundle bundle = data.getExtras(); CameraPosition camerapos = new CameraPosition.Builder() .target(new LatLng(bundle.getDouble("key.latitude"), bundle.getDouble("key.longitude"))) .zoom(15.0f).build(); // Move camera position mMap.moveCamera(CameraUpdateFactory.newCameraPosition(camerapos)); // Set current position mCenterPosition = camerapos; getNearestStation();/*from ww w. ja v a 2 s . c o m*/ break; case MapUtil.REQUEST_CODE_TWEET_STATUS_LOADER: mItemList = (ArrayList<TwitterStatusItem>) data.getSerializableExtra("LIST"); showTweetList(); break; default: break; } } }
From source file:com.lolo.focusdays.speechtotextdemo.location.MyLocationDemoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_location_demo); mMessageView = (TextView) findViewById(R.id.message_text); if (savedInstanceState != null) { double latitude = savedInstanceState.getDouble("marker.latitude"); double longitude = savedInstanceState.getDouble("marker.longitude"); if (latitude != 0.0d || longitude != 0.0d) { markerPosition = new LatLng(latitude, longitude); }/*from w w w . j a v a 2 s . c o m*/ if (savedInstanceState.getString("currentLocationAddress") != null) { this.currentLocation = new SimpleAddress(markerPosition, savedInstanceState.getString("currentLocationAddress"), savedInstanceState.getString("currentLocationZip"), savedInstanceState.getString("currentLocationCity"), savedInstanceState.getString("currentLocationCountry")); } } }
From source file:jp.co.tweetmap.Fragment1.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (LogUtil.isDebug()) Log.e(TAG, "### requestCode : " + requestCode); if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case MapUtil.REQUEST_CODE_FRAGMENT_1: // Called form StationSearchActivity Bundle bundle = data.getExtras(); CameraPosition camerapos = new CameraPosition.Builder() .target(new LatLng(bundle.getDouble("key.latitude"), bundle.getDouble("key.longitude"))) .zoom(15.0f).build(); // Move camera position mMap.moveCamera(CameraUpdateFactory.newCameraPosition(camerapos)); // Set current position mCenterPosition = camerapos; getNearestStation();// w ww. j a va2 s.c om break; case MapUtil.REQUEST_CODE_TWEET_STATUS_LOADER: mItemList = (ArrayList<TwitterStatusItem>) data.getSerializableExtra("LIST"); showTweetList(); break; default: break; } } }
From source file:jp.co.tweetmap.Fragment2.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (LogUtil.isDebug()) Log.e(TAG, "### requestCode : " + requestCode); if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case MapUtil.REQUEST_CODE_FRAGMENT_2: // Called form StationSearchActivity Bundle bundle = data.getExtras(); CameraPosition camerapos = new CameraPosition.Builder() .target(new LatLng(bundle.getDouble("key.latitude"), bundle.getDouble("key.longitude"))) .zoom(15.0f).build(); // Move camera position mMap.moveCamera(CameraUpdateFactory.newCameraPosition(camerapos)); // Set current position mCenterPosition = camerapos; getNearestStation();/*from w ww.j a v a2 s.c o m*/ break; case MapUtil.REQUEST_CODE_TWEET_STATUS_LOADER: mItemList = (ArrayList<TwitterStatusItem>) data.getSerializableExtra("LIST"); showTweetList(); break; default: break; } } }
From source file:com.joulespersecond.seattlebusbot.map.StopsRequest.java
@Override public void setState(Bundle args) { if (args != null) { Location center = null;//from w w w . j a v a2 s. c o m float mapZoom = args.getFloat(MapParams.ZOOM, MapParams.DEFAULT_ZOOM); double lat = args.getDouble(MapParams.CENTER_LAT); double lon = args.getDouble(MapParams.CENTER_LON); if (lat != 0.0 && lon != 0.0) { center = LocationHelp.makeLocation(lat, lon); } mFragment.getMapView().setZoom(mapZoom); if (center != null) { mFragment.getMapView().setMapCenter(center); onLocation(); } else { mFragment.setMyLocation(); } } else { mFragment.setMyLocation(); } }
From source file:org.croudtrip.fragments.join.JoinResultsFragment.java
private void startBackgroundSearch(Bundle bundle) { Timber.d("BG Search started"); final SharedPreferences prefs = getActivity().getSharedPreferences(Constants.SHARED_PREF_FILE_PREFERENCES, Context.MODE_PRIVATE); double currentLocationLat = bundle.getDouble(JoinDispatchFragment.KEY_CURRENT_LOCATION_LATITUDE); double currentLocationLon = bundle.getDouble(JoinDispatchFragment.KEY_CURRENT_LOCATION_LONGITUDE); double destinationLat = bundle.getDouble(JoinDispatchFragment.KEY_DESTINATION_LATITUDE); double destinationLon = bundle.getDouble(JoinDispatchFragment.KEY_DESTINATION_LONGITUDE); int maxWaitingTime = bundle.getInt(JoinDispatchFragment.KEY_MAX_WAITING_TIME); // Ask the server for matches TripQueryDescription tripQueryDescription = new TripQueryDescription( new RouteLocation(currentLocationLat, currentLocationLon), new RouteLocation(destinationLat, destinationLon), maxWaitingTime); Subscription subscription = tripsResource.queryOffers(tripQueryDescription) .compose(new DefaultTransformer<TripQueryResult>()).subscribe(new Action1<TripQueryResult>() { // SUCCESS @Override//from ww w .j a va 2s . c o m public void call(TripQueryResult result) { List<SuperTripReservation> reservations = result.getReservations(); // Update the caption text int numMatches = reservations.size(); if (numMatches != 0) { Timber.d("BG Search found results"); SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean(Constants.SHARED_PREF_KEY_SEARCHING, false); editor.apply(); //Set the notificationText in the navigationDrawer ((MaterialNavigationDrawer) getActivity()).getCurrentSection() .setNotifications(numMatches); //Switch out the view waitingView.setVisibility(View.GONE); resultView.setVisibility(View.VISIBLE); caption.setText(getResources().getQuantityString(R.plurals.join_trip_results, numMatches, numMatches)); // Fill the results list adapter.addElements(reservations); if (!(AccountManager.isUserLoggedIn(getActivity()))) { recyclerView.setBackgroundColor(Color.GRAY); drawRegisterDialog(); } } else if (result.getRunningQuery() != null) { Timber.d("BG Search did not find any results"); SharedPreferences.Editor editor = prefs.edit(); editor.putLong(Constants.SHARED_PREF_KEY_QUERY_ID, result.getRunningQuery().getId()); editor.apply(); } } }, new CrashCallback(this.getActivity(), "failed to join trip", new Action1<Throwable>() { @Override public void call(Throwable throwable) { Timber.e("Error when trying to join a trip: " + throwable.getMessage()); SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean(Constants.SHARED_PREF_KEY_SEARCHING, false); editor.apply(); Toast.makeText(getActivity().getApplicationContext(), getResources().getString(R.string.error), Toast.LENGTH_LONG).show(); Intent startingIntent = new Intent(Constants.EVENT_CHANGE_JOIN_UI); LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(startingIntent); } })); subscriptions.add(subscription); }