久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <small id='qh3U1'></small><noframes id='qh3U1'>

  1. <tfoot id='qh3U1'></tfoot>
      <bdo id='qh3U1'></bdo><ul id='qh3U1'></ul>

  2. <i id='qh3U1'><tr id='qh3U1'><dt id='qh3U1'><q id='qh3U1'><span id='qh3U1'><b id='qh3U1'><form id='qh3U1'><ins id='qh3U1'></ins><ul id='qh3U1'></ul><sub id='qh3U1'></sub></form><legend id='qh3U1'></legend><bdo id='qh3U1'><pre id='qh3U1'><center id='qh3U1'></center></pre></bdo></b><th id='qh3U1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='qh3U1'><tfoot id='qh3U1'></tfoot><dl id='qh3U1'><fieldset id='qh3U1'></fieldset></dl></div>

    1. <legend id='qh3U1'><style id='qh3U1'><dir id='qh3U1'><q id='qh3U1'></q></dir></style></legend>

      onLocationChanged 不會自動調用

      onLocationChanged is not called automatically(onLocationChanged 不會自動調用)
    2. <legend id='6PzqN'><style id='6PzqN'><dir id='6PzqN'><q id='6PzqN'></q></dir></style></legend>
    3. <i id='6PzqN'><tr id='6PzqN'><dt id='6PzqN'><q id='6PzqN'><span id='6PzqN'><b id='6PzqN'><form id='6PzqN'><ins id='6PzqN'></ins><ul id='6PzqN'></ul><sub id='6PzqN'></sub></form><legend id='6PzqN'></legend><bdo id='6PzqN'><pre id='6PzqN'><center id='6PzqN'></center></pre></bdo></b><th id='6PzqN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='6PzqN'><tfoot id='6PzqN'></tfoot><dl id='6PzqN'><fieldset id='6PzqN'></fieldset></dl></div>
      <tfoot id='6PzqN'></tfoot>

              <tbody id='6PzqN'></tbody>

                <bdo id='6PzqN'></bdo><ul id='6PzqN'></ul>

                <small id='6PzqN'></small><noframes id='6PzqN'>

              • 本文介紹了onLocationChanged 不會自動調用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我對 Android 中的 onLocationChanged 事件有疑問.這是觸發:

                I have a problem with onLocationChanged event in Android. Here's the triggering:

                case R.id.start: {
                    Points.add(overlay.getMyLocation()); // Points' type is ArrayList<GeoPoint>
                    mgr.requestLocationUpdates(best, 0, 3, locationListener);
                    }
                    break;
                

                這是 onLocationChanged 方法:

                And here's the onLocationChanged method:

                public void onLocationChanged(Location location) {
                    i++;
                    Points.add(overlay.getMyLocation());
                    MapOverlay mapOverlay = new MapOverlay(Points.get(i-1), Points.get(i));
                    map.getOverlays().add(mapOverlay); //does the drawing
                    mMapController.animateTo(Points.get(i));
                }
                

                因此,onLocationChanged 僅在我按下開始"后才被調用一次.它應該在每次位置更改時自動調用,對嗎?在我的情況下,它不是.
                請幫幫我.

                So, onLocationChanged is called only once and only after I press "start". It's supposed to be called automatically every time the location has changed, right? In my case, it's not.
                Please help me.

                推薦答案

                問題似乎解決了.在 onCreate 中,我添加了:

                Problem seems to be solved. In onCreate, I added:

                Criteria crit = new Criteria();
                crit.setAccuracy(Criteria.ACCURACY_FINE);
                best = mgr.getBestProvider(crit, false);
                mgr.requestLocationUpdates(best, 0, 1, locationListener);
                

                onLocationChanged 現在看起來像這樣:

                onLocationChanged now looks like that:

                @Override
                public void onLocationChanged(Location location) {
                    i++;
                    nextPoint = overlay.getMyLocation();
                    latitude = nextPoint.getLatitudeE6();
                    longtitude = nextPoint.getLongitudeE6();
                    lastPoint = new GeoPoint((int) latitude, (int) longtitude);
                    Points.add(lastPoint);
                    MapOverlay mapOverlay = new MapOverlay(Points.get(i - 1), Points.get(i));
                    map.getOverlays().add(mapOverlay);
                    mMapController.animateTo(Points.get(i));
                    nextPoint = null;
                    lastPoint = null;
                }
                

                另外,非常重要的方法:

                Also, very important methods:

                @Override
                protected void onResume() {
                    super.onResume();
                    mgr.requestLocationUpdates(best, 10000, 1, locationListener);
                }
                
                @Override
                protected void onPause() {
                    super.onPause();
                    mgr.removeUpdates(locationListener);
                }
                

                還有一些新的權限:

                <uses-permission android:name="android.permission.ACCESS_GPS" />
                        <uses-permission android:name="android.permission.ACCESS_LOCATION" />
                        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
                        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
                        <uses-permission android:name="android.permission.INTERNET" />
                

                這篇關于onLocationChanged 不會自動調用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Help calculating X and Y from Latitude and Longitude in iPhone(幫助從 iPhone 中的緯度和經度計算 X 和 Y)
                Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                CLLocation returning negative speed(CLLocation 返回負速度)
                How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網絡提供商)
                  • <tfoot id='wlIyM'></tfoot>

                      • <bdo id='wlIyM'></bdo><ul id='wlIyM'></ul>
                      • <small id='wlIyM'></small><noframes id='wlIyM'>

                        <i id='wlIyM'><tr id='wlIyM'><dt id='wlIyM'><q id='wlIyM'><span id='wlIyM'><b id='wlIyM'><form id='wlIyM'><ins id='wlIyM'></ins><ul id='wlIyM'></ul><sub id='wlIyM'></sub></form><legend id='wlIyM'></legend><bdo id='wlIyM'><pre id='wlIyM'><center id='wlIyM'></center></pre></bdo></b><th id='wlIyM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='wlIyM'><tfoot id='wlIyM'></tfoot><dl id='wlIyM'><fieldset id='wlIyM'></fieldset></dl></div>
                        <legend id='wlIyM'><style id='wlIyM'><dir id='wlIyM'><q id='wlIyM'></q></dir></style></legend>
                            <tbody id='wlIyM'></tbody>
                          主站蜘蛛池模板: 中文字幕日韩一区 | 在线观看国产三级 | 成人欧美一区二区三区在线观看 | 国产一二区在线 | 日本久久久影视 | 国产精品海角社区在线观看 | 久久激情视频 | 日韩网站免费观看 | 成人毛片网 | 可以看黄的视频 | 国产亚洲精品美女久久久久久久久久 | 国产精品视频一二三区 | 91精品国产综合久久精品 | 一区二区免费视频 | 亚洲国产成人精品女人 | 伊人免费在线 | 亚洲国产成人av好男人在线观看 | 玖玖玖在线观看 | 在线观看黄色大片 | 国产亚洲精品久久久久动 | 日本免费黄色 | 午夜爱爱毛片xxxx视频免费看 | 中文字幕在线观看精品 | 九九九久久国产免费 | 先锋资源网| 亚洲三区在线观看 | 久久久久久国 | 午夜免费视频 | 免费av电影网站 | 久久久久久九九九九九九 | 欧美久久精品一级黑人c片 91免费在线视频 | 九久久| 欧美国产日韩在线 | 精品毛片在线观看 | 国产一区二区在线视频 | 中文字幕蜜臀av | 亚洲精品久久区二区三区蜜桃臀 | 懂色av一区二区三区在线播放 | 国产精品免费av | 日韩成人免费av | 91porn在线 |