1. 程式人生 > 其它 >2021年1月31日 體溫上報app04

2021年1月31日 體溫上報app04

今天看了視訊,瞭解了定位一下是程式碼:

//地圖定位的功能
    class MyListener implements BDLocationListener {

        @Override
        public void onReceiveLocation(BDLocation bdLocation) {

//此處的BDLocation為定位結果資訊類,通過它的各種get方法可獲取定位相關的全部結果
            //以下只列舉部分獲取地址相關的結果資訊
            //更多結果資訊獲取說明,請參照類參考中BDLocation類中的說明
            String addr = bdLocation.getAddrStr();    //
獲取詳細地址資訊 String country = bdLocation.getCountry(); //獲取國家 String province = bdLocation.getProvince(); //獲取省份 String city = bdLocation.getCity(); //獲取城市 String district = bdLocation.getDistrict(); //獲取區縣 String street = bdLocation.getStreet(); //
獲取街道資訊 String adcode = bdLocation.getAdCode(); //獲取adcode String town = bdLocation.getTown(); //獲取鄉鎮資訊 et_address = (EditText) findViewById(R.id.add_tem_address); et_address.setText(addr); } }