Android:自动刷新谷歌地图

发布于 2024-09-10 07:34:05 字数 805 浏览 0 评论 0原文

我想问一下谷歌地图如何自动刷新?

所以我有一个带有单选按钮的活动,用户可以选择自动刷新的间隔。然后,我创建一个带有地图视图的类,其中的类扩展了 CountDownTimer。问题是 MyCountDownTimer 有一个显示其自己界面的构造函数。这是我的 CountDownTimer 类。

public class MyCountDownTimer extends CountDownTimer{   

    public MyCountDownTimer(long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
        // TODO Auto-generated constructor stub
    }
    @Override
    public void onFinish() {
    //do something when finish
    }
    @Override
    public void onTick(long millisUntilFinished) {
    //do something when the interval is choosen
        LocationManager.requestLocationUpdate(GPS_PROVIDER, userChoosenInterval, 0, LcoationListener)
    }
}

我如何修改此类,以便我的用户可以选择自己的自动刷新间隔,或者是否有其他方法可以自动刷新 goole 地图?谢谢。

~问候~

I want to ask about how to auto refresh the Google Maps?

So i have an activity with radio button inside that user can choose about the interval of the auto refresh. Then I create a class with a map view with class that extends the CountDownTimer. The problem is MyCountDownTimer has a constructor that display it own interface. Here is my CountDownTimer class.

public class MyCountDownTimer extends CountDownTimer{   

    public MyCountDownTimer(long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
        // TODO Auto-generated constructor stub
    }
    @Override
    public void onFinish() {
    //do something when finish
    }
    @Override
    public void onTick(long millisUntilFinished) {
    //do something when the interval is choosen
        LocationManager.requestLocationUpdate(GPS_PROVIDER, userChoosenInterval, 0, LcoationListener)
    }
}

how can i modify this class so my user can choose their own interval of auto refresh, or is there any other way around of how to auto-refresh the goole maps? thanks.

~Regards~

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

有木有妳兜一样 2024-09-17 07:34:05

我做了类似的事情,允许用户设置特定操作的时间间隔。我使用 PreferenceActivity 允许用户设置时间,然后从类中读取首选项来设置用户定义的时间间隔。

I've done something similar, allowing users to set the time interval for a particular action. I used the PreferenceActivity to allow the user to set the time, then read from the preferences within my class to set the user defined time interval.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文