Android Open Source - GPS-Compass Data Interface






From Project

Back to project page GPS-Compass.

License

The source code is released under:

GNU General Public License

If you think the Android project GPS-Compass listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.gps_compass;
// w w w  .ja v  a2 s.co  m
import android.location.Location;


public class DataInterface {
  
  long id;
  private String name;
  private Location coordinates = new Location("GPS_PROVIDER"); 
  private double longitude;
  private double latitude;
  
  //constructors
  public DataInterface(){
  }
  public DataInterface(long id, String name, double longitude, double latitude){
    this.id = id;
    this.name = name;
    this.longitude = longitude;
    this.latitude = latitude;
    this.coordinates.setLongitude(longitude);
    this.coordinates.setLatitude(latitude);
  }
  
  //setters
  public void setCoordinates(Location coord){
    this.coordinates = coord;
    this.longitude = coord.getLongitude();
    this.latitude = coord.getLatitude();
  }
  public void setLatitude(double latitude){
    this.coordinates.setLatitude(latitude);
    this.latitude = latitude;
  }
  
  public void setLongitude(double longitude){
    this.coordinates.setLongitude(longitude);
    this.longitude = longitude;
  }
  
  public void setName( String name){
    this.name = name;
  }
  
  public void setId(long id){
    this.id = id;
  }
  
  //getters
  public double getLongitude(){
    return this.longitude;
  }

  public double getLatitude(){
    return this.latitude;
  }
  
  public String getName(){
    return this.name;
  }
  
  public Location getCoordinates(){
    return this.coordinates;
  }
  
  public long getId(){
    return this.id;
  }
  
}




Java Source Code List

com.example.gps_compass.CreateTargetActivity.java
com.example.gps_compass.DataInterface.java
com.example.gps_compass.DatabaseHandler.java
com.example.gps_compass.MainActivity.java