Android Open Source - spotdroid Location Data






From Project

Back to project page spotdroid.

License

The source code is released under:

MIT License

If you think the Android project spotdroid 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.spotdroid.mobile.android.data;
//from w  ww . j  a  v  a2 s  . c o m
import java.io.Serializable;
import java.util.Date;

import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * ormlite data object for location data.
 * 
 */
@DatabaseTable(tableName = "location")
public class LocationData implements Serializable {

  public LocationData() {
    super();
    this.timestamp = new Date();  
  }

  private static final long serialVersionUID = 8532070207251592573L;

  public LocationData(double latitude, double longitude) {
    super();
    this.latitude = latitude;
    this.longitude = longitude;
    this.timestamp = new Date(); 
  }

  @DatabaseField(generatedId = true)
  private Integer id;

  @DatabaseField
  private double latitude;

  @DatabaseField
  private double longitude;

  @DatabaseField(dataType = DataType.DATE_LONG)
  private Date timestamp;

  public Integer getId() {
    return id;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  public double getLatitude() {
    return latitude;
  }

  public void setLatitude(double latitude) {
    this.latitude = latitude;
  }

  public double getLongitude() {
    return longitude;
  }

  public void setLongitude(double longitude) {
    this.longitude = longitude;
  }

  public Date getTimestamp() {
    return timestamp;
  }

  public void setTimestamp(Date timestamp) {
    this.timestamp = timestamp;
  }

  @Override
  public String toString() {

    String time = "";
    if (timestamp != null) 
    {
      time = timestamp.toGMTString();
    }

    return "LocationData [id=" + id + ", latitude=" + latitude
        + ", longitude=" + longitude + ", timestamp=" + time + "]";
  }

}




Java Source Code List

com.spotdroid.mobile.android.data.DatabaseHelper.java
com.spotdroid.mobile.android.data.LocationData.java
com.spotdroid.mobile.android.gui.ActivityIndexActivity.java
com.spotdroid.mobile.android.gui.LocationActivity.java
com.spotdroid.mobile.android.gui.MainActivity.java
com.spotdroid.mobile.android.gui.PreferenceData.java
com.spotdroid.mobile.android.gui.SettingsActivity.java
com.spotdroid.mobile.android.gui.SplashActivity.java