电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

android获取经度、维度、海拔简单代码

android获取经度、维度、海拔简单代码_第1页
android获取经度、维度、海拔简单代码_第2页
android获取经度、维度、海拔简单代码_第3页
import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Date; import android.app.Activity; import android.content.Context; import android.graphics.Typeface; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.TextView; public class GPSInfoActivity extends Activity { private static final String TAG = "GPSInfoActivity"; private TextView tv_gps_info_lon; private TextView tv_gps_info_lat; private TextView tv_gps_info_hei; private TextView tv_gps_info_time; public static Typeface tf; private DecimalFormat df = new DecimalFormat("###.000000"); private LocationManager locationManager; private LocationListener LocationListener; private Location lastTimeLocation=null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gpsinfo); ((OsmandApplication) getApplication()).setTopActivity(this); tv_gps_info_lon = (TextView) findViewById(R.id.tv_gps_info_lon); tv_gps_info_lat = (TextView) findViewById(R.id.tv_gps_info_lat); tv_gps_info_hei = (TextView) findViewById(R.id.tv_gps_info_hei); tv_gps_info_time = (TextView) findViewById(R.id.tv_gps_info_time); tf = Typeface.createFromAsset(getAssets(), "fonts/digi.ttf"); tv_gps_info_lon.setTypeface(tf); tv_gps_info_lat.setTypeface(tf); tv_gps_info_time.setTypeface(tf); tv_gps_info_hei.setTypeface(tf); locationManager= (LocationManager) getSystemService(Context.LOCATION_SERVICE); LocationListener = new LocationListener() { public void onLocationChanged(Location location) { //当坐标改变时触发此函数,如果Provider传进相同的坐标,它就不会被触发 // log it when the location changes if (location != null) { locationManager.removeUpdates(LocationListener); } upd...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部