List of usage examples for android.location Location reset
public void reset()
From source file:com.hybris.mobile.activity.StoreLocatorActivity.java
@Override protected void onResume() { super.onResume(); handleIntent();/*from ww w .j a v a 2s. c o m*/ // Launching the activity from an intent, we try to look if there is a city identifier or just a radius (geolocation) if (getIntent().hasExtra(DataConstants.STORE_LOCATOR_RADIUS_VALUE) || (getIntent().hasExtra(DataConstants.STORE_LOCATOR_LAT) && getIntent().hasExtra(DataConstants.STORE_LOCATOR_LONG) && getIntent().hasExtra(DataConstants.STORE_LOCATOR_RADIUS_VALUE))) { String radiusValue = getIntent().getStringExtra(DataConstants.STORE_LOCATOR_RADIUS_VALUE); String latValue = getIntent().getStringExtra(DataConstants.STORE_LOCATOR_LAT); String longValue = getIntent().getStringExtra(DataConstants.STORE_LOCATOR_LONG); // Is geolocation? boolean isGeolocation = StringUtils.isNotEmpty(radiusValue) && StringUtils.isEmpty(latValue) && StringUtils.isEmpty(longValue); // Geolocation, we just need the radius if (isGeolocation) { try { mRadius = Float.valueOf(radiusValue); // Getting the user coordinates setCurrentUserLocation(); } catch (Exception e) { // do nothing, error in case of wrong radius format } } // Store location by coordinates, we need the longitude, latitude and the radius else if (StringUtils.isNotEmpty(latValue) && StringUtils.isNotEmpty(longValue) && StringUtils.isNotEmpty(radiusValue)) { mRadius = Float.valueOf(radiusValue); float latitude = Float.valueOf(latValue); float longitude = Float.valueOf(longValue); // Creating a new location based on the coordinates Location location = new Location(""); location.reset(); location.setLatitude(latitude); location.setLongitude(longitude); fetchStoreFromParticularLocation(location); } } }