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));
        }
  • 相关阅读:
    Golang相关环境变量
    mac catalina关闭系统更新提示
    Git常用命令
    UDP打洞原理
    LANMP相关配置
    Windows平台编译libevent
    Sublime text2 + cygwin编译C++
    C++的指针常量和常量指针
    C++的new和delete
    C/C++产生随机数
  • 原文地址:https://www.cnblogs.com/zyj3955/p/14869649.html
Copyright © 2011-2022 走看看