zoukankan      html  css  js  c++  java
  • 个人冲刺(六)——体温上报app(一阶段)

    任务:完成了自动获取定位信息以及自动获取时间功能

    自动获取定位信息

     public void onReceiveLocation(BDLocation location){
                //此处的BDLocation为定位结果信息类,通过它的各种get方法可获取定位相关的全部结果
                //以下只列举部分获取地址相关的结果信息
                //更多结果信息获取说明,请参照类参考中BDLocation类中的说明
                String addr = location.getAddrStr();    //获取详细地址信息
                String country = location.getCountry();    //获取国家
                String province = location.getProvince();    //获取省份
                String city = location.getCity();    //获取城市
                String district = location.getDistrict();    //获取区县
                String street = location.getStreet();    //获取街道信息
                String adcode = location.getAdCode();    //获取adcode
                String town = location.getTown();
                //获取乡镇信息
                text4=(EditText)findViewById(R.id.tv_text4);
                text4.setText(country+province+city+district+town+street+adcode);
            }

    自动获取时间

     public void autoTimeAndDate(View view)
        {
            text2=(EditText)findViewById(R.id.tv_text2);
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");// HH:mm:ss
    //获取当前时间
            Date date = new Date(System.currentTimeMillis());
            text2.setText(simpleDateFormat.format(date));
        }
  • 相关阅读:
    学渣逆袭回忆录:0序
    selenium和Firefox版本不兼容
    学习Python的第一课(简单的单元测试)
    C# 实现模拟登录功能,实现公共类分享。
    MVC之权限管理-网站开发之路
    程序员学习之路
    【数据结构】浅谈线性数据结构
    【数据结构】二叉堆
    tire 学习心得
    洛谷P1801 黑匣子
  • 原文地址:https://www.cnblogs.com/zyj3955/p/14869649.html
Copyright © 2011-2022 走看看