Fragment通信onlocation的活动发生了变化

时间:2017-07-06 10:46:23

标签: android-fragments android-activity android-viewpager location

我已经在我的活动上实现了位置服务,,,,当我获得onlocation的位置改变了....我将使用Geocoder将其转换为地址...现在我需要设置值视图寻呼机中的一个片段...如何做...请帮助..

  @Override
public void onLocationChanged(Location location) {

    latitude = location.getLatitude();
    longitude = location.getLongitude();

    address = Utility.getAddress(RegistrationPersonaliseActivity.this, location);

    Log.e("tag", "Lat-->" + latitude + "long-->" + longitude + "Address-->" + address);


}

1 个答案:

答案 0 :(得分:0)

    @Override
public void onLocationChanged(Location location) {

    latitude = location.getLatitude();
    longitude = location.getLongitude();

    address = Utility.getAddress(RegistrationPersonaliseActivity.this, location);

    Prefs.setLoc(address);
}


    final Handler ha=new Handler();
    ha.postDelayed(new Runnable() {

        @Override
        public void run() {
            //call function
            place.setText(Prefs.getLoc());
            ha.postDelayed(this, 10000);
        }
    }, 10000);