请选择 进入手机版 | 继续访问电脑版
  • 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

如何将双纬和双经度设置为数组

原作者: [db:作者] 来自: 网络 收藏 邀请

您好请看下面我的代码。如何将双纬和双经度设置为数组

 public void onClick(View arg0) {  
       // create class object 
       gps = new GPSTracker(MainActivity.this); 

       // check if GPS enabled  
       if(gps.canGetLocation()){ 

        double latitude = gps.getLatitude(); 
        double longitude = gps.getLongitude(); 

        String mydate = java.text.DateFormat.getDateTimeInstance().format(Calendar.getInstance().getTime()); 

        // \n is for new line 

        Toast.makeText(getApplicationContext(), "Time : " +mydate + " Your Location is - \nLat: " 
        + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show(); 

       } 

在GPSTracker类:​​

public double getLatitude(){ 
    if(location != null){ 
     latitude = location.getLatitude(); 
    } 

    // return latitude 
    return latitude; 
} 

/** 
* Function to get longitude 
* */ 
public double getLongitude(){ 
    if(location != null){ 
     longitude = location.getLongitude(); 
    } 

    // return longitude 
    return longitude; 
} 

我想经度和纬度保存到阵列。

与点击btnShowLocation按钮时一样,纬度将设置为n1x,其经度为n1y。

然后,第二次单击该按钮时,纬度将设置为n2x,其经度为n2y。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
你好我正在使用离子科尔多瓦发布时间:2022-02-24
下一篇:
什么让使用PHP的preg_match发布时间:2022-02-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap