Location setSpeed - 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 setSpeed method.

This code example shows how to use the following methods:setAccuracy, setAltitude, setBearing, setLatitude, setLongitude
	/** 
	 * Converts the Location Message to {@link Location}. 
	 * @return An {@link Location} with the information of this Message. 
	 */ 
	public Location toAndroidLocation() {
		Location location = new Location((String)null);
		location.setLatitude(latitude);
		location.setLongitude(longitude);
		if(hasAltitude) {
			location.setAltitude(altitude);
		} 
		if(hasAccuracy) {
			location.setAccuracy(accuracy);
		} 
		if(hasBearing) {
			location.setBearing(bearing);
		} 
		if(hasSpeed) {
			location.setSpeed(speed);
		} 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setAltitude, setBearing, setLatitude, setLongitude
		return uri;
	} 
 
	public static Location decodeLocation(Uri uri) {
		String[] data = uri.getPath().split("/");
		Location l = new Location("Geoloqi");
		l.setLatitude(Float.parseFloat(data[1]));
		l.setLongitude(Float.parseFloat(data[2]));
		l.setAltitude(Float.parseFloat(data[3]));
		l.setBearing(Float.parseFloat(data[4]));
		l.setSpeed(Float.parseFloat(data[5]));
		l.setTime(Long.parseLong(data[6]));
		l.setAccuracy(Float.parseFloat(data[7]));
		return l;
	} 
 
	public static int getMinTime(Context context) {
		SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(context);
		String minTime = p.getString(GeoloqiPreferences.PREF_MINTIME_KEY, "5");
		return Integer.parseInt(minTime) * 1000;
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setAltitude, setBearing, setExtras, setLatitude
This code example shows how to use the following methods:setAccuracy, setAltitude, setLatitude, setLongitude, setSpeed
     
    // test for correct sample data type 
    if ( data instanceof LocationSampleData )
    { 
      LocationSampleData locData = (LocationSampleData) data;
      location = new Location( sample.getDeviceIdentifier() );
      location.setTime( sample.getTimeStamp() );
      location.setLatitude( locData.getLatitude() );
      location.setLongitude( locData.getLongitude() );
      if ( locData.getAltitude() != null )
      { 
        location.setAltitude( locData.getAltitude() );
      } 
      if ( locData.getAccuracy() != null )
      { 
        location.setAccuracy( locData.getAccuracy() );
      } 
      if ( locData.getSpeed() != null )
      { 
        location.setSpeed( locData.getSpeed() );

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setAltitude, setLatitude, setLongitude, setSpeed
		SQLiteDatabase db = this.getReadableDatabase();
		Cursor cursor = db.rawQuery(
				"SELECT LATITUDE, LONGITUDE, ALTITUDE, SPEED, ACCURACY, TIME FROM LOCATION" 
						+ " WHERE ID=" + Long.toString(id), new String[] {});
		if (cursor.moveToFirst()) {
			Location location = new Location(LocationManager.GPS_PROVIDER);
			location.setLatitude(cursor.getDouble(0));
			location.setLongitude(cursor.getDouble(1));
			location.setAltitude(cursor.getDouble(2));
			location.setSpeed(cursor.getFloat(3));
			location.setAccuracy(cursor.getFloat(4));
			location.setTime(cursor.getLong(5));
			return location;
		} 
		return null; 
	} 
 
	// Get list of points 
	public Cursor getPointList(String trackName, boolean wpt, boolean desc) {
		SQLiteDatabase db = this.getReadableDatabase();
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setBearing, setLatitude, setLongitude, setSpeed
		AndroidMock.replay(locationServiceMock);
		LocationMessageHandler handler = aHandlerForTest();
		handler.handleMessage(new LocationMessage(androidLocation, 
												  location,
												  bearing,
												  speed));
	} 
	 
	/** 
	 * In addition to {@link AbstractTestCaseForClientMessageHandler#verifyFieldMocks()} 
	 * is set up also verifies {@link #locationServiceMock}. 
	 */ 
	@Override 
	protected void verifyFieldMocks() { 
		super.verifyFieldMocks(); 
		AndroidMock.verify(locationServiceMock);
	} 
	 
	/** 
	 * Mocks the location of this device (Client). 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setAltitude, setLatitude, setLongitude, setSpeed
This code example shows how to use the following methods:setAccuracy, setBearing, setLatitude, setLongitude, setProvider
	 * Converts #this to it's equiv Android based location object. 
	 *  
	 * @return teh android based Location 
	 */ 
	public Location returnEquivalentLocation() {
		Location returnLocation = new Location(provider);
		returnLocation.setAccuracy((float) accuracy);
		returnLocation.setBearing(bearing);
		returnLocation.setLatitude(latitude);
		returnLocation.setLongitude(longitude);
		returnLocation.setSpeed(speed);
		returnLocation.setProvider(provider);
		returnLocation.setTime(time);
		return returnLocation;
	} 
 
	public boolean hasAccuracy() { 
		return hasAccuracy;
	} 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setAltitude, setBearing, setLatitude, setLongitude
This code example shows how to use the following methods:setAccuracy, setAltitude, setBearing, setLatitude, setLongitude
	 * Generates a dummy location with given seed 
	 * @param seed 
	 * @return Location 
	 */ 
	private Location getDummyLocation(long seed) {
		Location loc = new Location("gps");
		Random r = new Random(seed);
		 
		loc.setAccuracy(r.nextFloat());
		loc.setAltitude(r.nextDouble());
		loc.setBearing(r.nextFloat());
		loc.setLatitude(r.nextDouble());
		loc.setLongitude(r.nextDouble());
		loc.setSpeed(r.nextFloat());
		loc.setTime(r.nextLong());
		 
		return loc;
	} 
	 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Location setSpeed Questions & Answers:

setSpeed Method Overview
Set the speed, in meters/second over ground.
See Code Examples for other Android Location Methods: