Location setLongitude - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Location setLongitude method.

This code example shows how to use the following methods:setAccuracy, setLatitude, setLongitude
     
    public Location getHomeLocation() {
    	if(!settings.getBoolean("haveHomeLocation", false))
    		return null; 
    	 
    	Location loc = new Location("Home");
    	loc.setLatitude(settings.getFloat("HomeLocLat", (float)40.443181));  // Easter Egg: default value
    	loc.setLongitude(settings.getFloat("HomeLocLong", (float)-79.943060));
    	loc.setAccuracy(settings.getFloat("HomeLocAccuracy", 100000));
    	return loc;
    } 
     
    // Higher level settings 
    public int getClientID() { return settings.getInt("randClientID",-1); }
    public void setClientID(int id) { sEditor.putInt("randClientID", id); sEditor.commit(); }
    public String getHomeSSID() { return settings.getString("homeSSID", null); }
    public void setHomeSSID(String ssid) { sEditor.putString("homeSSID", ssid); sEditor.commit(); }
     
    // For some 802.11 wireless settings 
    public int getHomeWifiFreq() { return settings.getInt("homeWifiFreq", -1); }
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setLatitude, setLongitude
	private List<Location> m_list;
 
	protected void setUp() throws Exception { 
		super.setUp(); 
		m_list = new ArrayList<Location>();
		Location loc = new Location("foo");
		loc.setLongitude(0);
		loc.setLatitude(0);
		m_list.add(loc);
		m_list.add(loc);
	} 
 
	public void testWriter() { 
		GpxCharArrayWriter w = new GpxCharArrayWriter(m_list, 17, 32);
		System.out.println(w.toString());
		System.out.println("blabla");
		assertTrue(true);
	} 
	protected void tearDown() throws Exception { 
		m_list = null;
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setLatitude, setLongitude
					latitude = savedInstanceState.getDouble(ParamIntent.ACTIVITY_SEARCH_LATITUDE, 0); 
					longitude = savedInstanceState.getDouble(ParamIntent.ACTIVITY_SEARCH_LONGITUDE, 0); 
					if ((latitude != 0) && (longitude != 0)) { 
						intentResult.putExtra(ParamIntent.ACTIVITY_SEARCH_LATITUDE, latitude); 
						intentResult.putExtra(ParamIntent.ACTIVITY_SEARCH_LONGITUDE, longitude); 
						Location location = new Location("GPS"); 
						location.setLatitude(latitude); 
						location.setLongitude(longitude); 
						getModelActivity().setLocalisation(location); 
					} 
					resultFragment.setIntentResult(intentResult); 
					getSupportFragmentManager().beginTransaction().replace(R.id.zoneWidgetResults, resultFragment).commit(); 
				} 
 
			} 
		} 
	} 
 
	/* 
	 * Interaction 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getLatitude, getLongitude, setLatitude, setLongitude
    recentMeasurements.put(sensorName, value);
 
    Location location = getLocation();
    if (location != null && sensor != null && sensor.isEnabled())
    { 
      double latitude = location.getLatitude();
      double longitude = location.getLongitude();
 
      Measurement measurement = new Measurement(latitude, longitude, value, event.getDate());
      if (sessionStarted)
      { 
        MeasurementStream stream = prepareStream(event);
        stream.add(measurement);
      } 
 
      eventBus.post(new MeasurementEvent(measurement, sensor));
    } 
  } 
 
  private Location getLocation()
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setLatitude, setLongitude, setTime
			} 
		} 
    	 
    	private void setLocation(LocationManager locationManager, String locationProvider, double latitude, double longitude) {
 
    		Location location = new Location(locationProvider);
    		location.setLatitude(latitude);
    		location.setLongitude(longitude);
    		location.setAccuracy(1);
    		location.setTime(System.currentTimeMillis());
 
            try { 
                Method makeComplete = Location.class.getMethod("makeComplete");
                if (makeComplete != null) {
                    makeComplete.invoke(location);
                } 
            } catch (Exception e) {
                //Method only available in Jelly Bean 
            } 
 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setLatitude, setLongitude
                            "supportsSpeed" == "", 
                            "supportsBearing" == "", 
                             android.location.Criteria.POWER_LOW,
                             android.location.Criteria.ACCURACY_FINE);      
 
        Location newLocation = new Location(LocationManager.GPS_PROVIDER);
 
        newLocation.setLatitude(latitude);
        newLocation.setLongitude(longitude);
        newLocation.setAccuracy(accuracy);
 
        lm.setTestProviderEnabled(LocationManager.GPS_PROVIDER, true);
 
        lm.setTestProviderStatus(LocationManager.GPS_PROVIDER,
                                 LocationProvider.AVAILABLE,
                                 null,System.currentTimeMillis());    
       
        lm.setTestProviderLocation(LocationManager.GPS_PROVIDER, newLocation);      
 
    } 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setLatitude, setLongitude
    @MediumTest 
    @LargeTest 
    public void testExecutePlaceRequestWithLocation() { 
        TestSession session = openTestSessionWithSharedUser();
 
        Location location = new Location("");
        location.setLatitude(47.6204);
        location.setLongitude(-122.3491);
 
        Request request = Request.newPlacesSearchRequest(session, location, 5, 5, null, null);
        Response response = request.executeAndWait();
        assertNotNull(response);
 
        assertNull(response.getError());
 
        GraphMultiResult graphResult = response.getGraphObjectAs(GraphMultiResult.class);
        assertNotNull(graphResult);
 
        List<GraphObject> results = graphResult.getData();
        assertNotNull(results);
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setAltitude, setLatitude, setLongitude
		Location l1 = getLocation(lat1, lon1);
		Location l2 = getLocation(lat2, lon2);
		return l1.distanceTo(l2);
	} 
	public static Location getLocation(double lat, double lon) {
		Location l2 = new Location("gps");
		l2.setLatitude(lat);
		l2.setLongitude(lon);
		l2.setAltitude(0);
		return l2;
	} 
 
	public static synchronized void updateRequired(Context context, boolean req) {
		if (context==null) {
			Log.e(TAG,"updateRequired called with null context - ignored");
			return; 
		} 
		Log.d(TAG,"updateRequired("+req+")");
		if (locationCallback==null) {
			locationCallback = new LocationCallback(context);			
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:distanceTo, setLatitude, setLongitude
     * getDistance: determines the distance, in miles, between this Restaurant and the GeoPoint param 
     * @param pointA: the point from which the distance to the restaurant is being measured 
     * @return: the distance, in miles, between the two points. Is a float.  
     */ 
    public double getDistance(GeoPoint pointA){
        Location locationA = new Location("point A");
     
        locationA.setLatitude(pointA.getLatitudeE6() / 1E6);
        locationA.setLongitude(pointA.getLongitudeE6() / 1E6);
     
        Location locationB = new Location("point B");
     
        locationB.setLatitude(mLocation.getLatitudeE6() / 1E6);
        locationB.setLongitude(mLocation.getLongitudeE6() / 1E6);
     
        return roundDouble(locationA.distanceTo(locationB)/1609.34);//return in miles, not meters
    } 
     
    /** 
     * roundDouble: Takes in a Double value and rounds it to a single decimal place 
     * @param d: the Double value 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setLatitude, setLongitude, setTime
		return location.hasAccuracy();
	} 
	 
	private static Location createFromGeneric(GenericLocation g)
	{ 
		Location l = new Location(g.getProvider());
		l.setAccuracy(g.getAccuracy());
		l.setLatitude(g.getLatitude());
		l.setLongitude(g.getLongitude());
		l.setTime(g.getTime());
			 
		return l;
	} 
 
	@Override 
	public String getProvider() {
		return location.getProvider();
		 
	}	 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Location setLongitude Questions & Answers:

setLongitude Method Overview
Set the longitude, in degrees.
See Code Examples for other Android Location Methods: