位置不被更新在Android模拟器新的地缘修复 [英] Location not being updated on new geo fix in android emulator

查看:219
本文介绍了位置不被更新在Android模拟器新的地缘修复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使它所以图形页面缩放到基于一个GeoPoint的当前位置。我设置使用的telnet地缘fix命令的位置。我的问题是,当我第一次输入使用地理的位置修复我的code将正确定位到地图上的位置。如果我尝试设置其他位置使用地理修复但它不会更新。这里是code更新:

I am trying to make it so a MapView zooms to a current location based on a GeoPoint. I am setting the location using the geo fix command in telnet. My problem is that when I first input a location using geo fix my code will correctly navigate to a location on the map. If I try to set another location using geo fix however it does not update. Here is the code to update:

public void updateLocation(Location loc) {
    p = new GeoPoint((int)(loc.getLongitude() * 1E6),(int)(loc.getLatitude() * 1E6));

    mc = mapView.getController();

    mc.animateTo(p);
}

和这里是我的code调用更新:

and here is my code to call the update:

LocationListener onLocationChange=new LocationListener() {
    public void onLocationChanged(Location location) {
        updateLocation(location);
    }

等等......

etc...

我在onResume()以下内容:

I have the following in onResume():

    super.onResume();
    myLocationManager.requestLocationUpdates("gps", 0, 200, onLocationChange);

我试图地理修复程序是足够远,以满足最小距离要求的要点。任何人有我失去了我的任何想法?

The points I am trying to geo fix to are far enough apart to meet the minimum distance requirement. Anyone have any ideas of what I'm missing?

推荐答案

呼叫 mapView.invalidate(); (见的查看:无效() mapView.postInvalidate(); (见的查看:postInvalidate()的,这取决于它是否运行在UI线程与否,​​之后

mc.animateTo(p);

这篇关于位置不被更新在Android模拟器新的地缘修复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆