1. 程式人生 > >arcgis-android-100.2 bug:Can only call this method on a loaded table

arcgis-android-100.2 bug:Can only call this method on a loaded table

剛剛接觸arcgis android,在儲存地圖要素的時候出現bug,導致應用閃退。異常日誌:

this = {[email protected]} 
t = {[email protected]} "Thread[main,5,main]"
e = {[email protected]} "com.esri.arcgisruntime.ArcGISRuntimeException: Cannot call this method in this context"
 mAdditionalMessage = "Can only call this method on a loaded table."
 mCause = null
 mCode = 15
 mDomain = {
[email protected]
} "ARCGIS_RUNTIME" mErrorMessage = "Cannot call this method in this context" cause = {[email protected]} "com.esri.arcgisruntime.ArcGISRuntimeException: Cannot call this method in this context"

異常程式碼為:


  private void save2ArcgisService() {
        //儲存路徑到arcgis伺服器
        final ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(featureUrl);
        FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable);
        map.getMap().getOperationalLayers().add(featureLayer);
        polylinePoints.add(new Point(23.041117,113.810075));
        addFeature( new Polyline(polylinePoints), serviceFeatureTable);

    }

異常發生原因為ServiceFeatureTable載入完成之前呼叫地圖要素儲存方法。程式碼更正:

    private void save2ArcgisService() {
        //儲存路徑到arcgis伺服器
        final ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(featureUrl);
        FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable);
        map.getMap().getOperationalLayers().add(featureLayer);
        polylinePoints.add(new Point(23.041117,113.810075));
        serviceFeatureTable.setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_NO_CACHE);
        serviceFeatureTable.addLoadStatusChangedListener(new LoadStatusChangedListener() {
            @Override
            public void loadStatusChanged(LoadStatusChangedEvent loadStatusChangedEvent) {
                if (loadStatusChangedEvent.getNewLoadStatus() == LoadStatus.LOADED) {
                    addFeature( new Polyline(polylinePoints), serviceFeatureTable);
                }

            }
        });

    }

異常解決。

相關推薦

arcgis-android-100.2 bug:Can only call this method on a loaded table

剛剛接觸arcgis android,在儲存地圖要素的時候出現bug,導致應用閃退。異常日誌: this = {[email protected]} t = {[email protected]} "Thread[main,5,main]" e = {

Android開發中出現Attempt to invoke virtual method...on a null object reference

摘要: 載入Android佈局檔案時出現錯誤: java.lang.NullPointerException: Attempt to invoke virtual method '........' on a null object reference 出錯原因可能是未能在

ArcGIS Runtime for Android 100.2.1學習筆記》二:通過WebTiledLayer載入天地圖

1、WebTiledLayer    WebTiledLayer是100.1後新加入的圖層型別,用於定義一個可擴充套件的切片圖層,該圖層根據URL從切片伺服器中請求影象,它提供了一種將非ArcGIS Services作為圖層繼承到地圖中的簡單方法。    URL通常遵循:ht

arcgis for android 100.2一些總結(一)

中離線地圖格式:.shp:可編輯、查詢、刪除、更新的向量地圖格式。展示比較慢,可以搭配.tpk一起使用。MPK、TPK、GPK和GCPK分別對應地圖資料包、切片資料包、地理處理工具包以及地理編碼工具包。MPK、TPK、GPK、GCPK需要在ArcMap中製作生成。Map pa

ValueError: Only call `sparse_softmax_cross_entropy_with_logits` with named a

entropy spa initial bsp sof 網絡 label ria value 第五章中完整的訓練MNIST數據的神經網絡模型的程序代碼中,直接運行程序的話會遇到以下的錯誤。 把下面的這行代碼 # 計算交叉熵及其平均值 cross_entropy = t

《TensorFlow實戰例項》的一些錯誤更正ValueError: Only call `sparse_softmax_cross_entropy_with_logits` with named a

在學習《TensorFlow實戰Google深度學習框架》這本書的時候,發現書上提供的程式碼有一些錯誤。原因是自己的TensorFlow的版本比較高,相對於書上的版本,一些API都變了,所以有些函式在書中的程式中是錯誤的,所以程式在執行的時候就會報錯。 比如:第五章中完

It is illegal to call this method if the current request is not in asynchronous mode

nested exception is java.lang.IllegalStateException: It is illegal to call this method if the current request is not in asynchronous mode (i.e. is

java.lang.IllegalStateException: It is illegal to call this method if the current request is not in

使用fastjson報的錯誤 原因是序列化了 ServletRequest ServletResponse MultipartFile 這些類的物件 而這些類的物件不能序列化 參考 關於一次AOP攔截入參記錄日誌報錯的梳理總結 It is illegal to call thi

使用RecyclerView中引發 java.lang.IllegalStateException: Cannot call this method while RecyclerView is com

出錯原因 在介面卡onBindViewHolder(….)方法裡呼叫了notifyItemChanged(position),導致RecyclerView還沒有渲染完滑動引發的 錯誤程

Android Studio中ArcGIS Runtime Android SDK 100.1.0(100.2.0,100.3.0)開發原生地圖應用(入門環境配置)

前言     最近因為工作關係,需要使用ArcGIS Runtime SDK for Android搭建一個簡單的入門Demo,也就是傳說中的Hello GISer。翻了一遍官方文件,ArcGIS Runtime SDK for Android的安裝推薦使用Gradle,而

android arcgis100.0.0)載入MMPK和GEODATABASE資料型別的離線圖層

arcgis版本:arcgis-android:100.0.0 圖層型別:使用FeatureLayer 資料型別:MMPK,GEODATABASE //圖層載入類 LayerUtil{ private static ArrayList<FeatureLayer> mFe

android arcgis100.0.0) 載入網路圖層

arcgis版本:arcgis-android:100.0.0 載入線上地圖: 1.是使用ArcGISMapImageLayer載入,以圖片形式載入整個地圖,適合大資料量載入 ArcGISMapImageLayer layer = new ArcGISMapImageLayer(

ArcGIS for Android 100.3的學習與應用(三) 實現地圖新增自定義指北針

圖為高德地圖實現指北針的效果,那麼ArcGIS如何實現呢? 實現方式: 新增地圖的旋轉監聽: map.addMapRotationChangedListener(new MapRotationChangedListener() { @Override

ArcGIS for Android 100.3的學習與應用(二) 如何移除指定的點和線?

在地圖上新增點和線的時候,我們有時候會遇到要移除或者切換指定的點和線的操作。那麼如何移除指定的點和線呢? ArcGIS的api裡點和線都是由GraphicsOverlay類來進行建立新增的。通過Graphic物件將點或者線的圖形物件(SimpleMarkerSymbol,SimpleLine

ArcGIS for Android 100.3的學習與應用(一) 如何繪製點和線?

平時工作中,我們接觸到的地圖類開發平臺有很多,最常用的有高德,百度,騰訊地圖。而且它們都有自己的開發者平臺和文件供我們使用。基本能滿足我們的業務需求。 由於公司裡的專案會涉及一些地圖資料統計和展示方面的需求,同時也會發布一些地圖服務,所以選擇了使用在地圖方面比較牛逼的ArcGIS。 把平時遇

【我的Android進階之旅】使用Retrofit進行Post請求報錯: @Field parameters can only be used with form encoding.

一、問題描述 今天隨手寫一個post請求的時候,報錯了,如下所示: 09-28 11:11:28.155 10547-10547/com.xtc.watch E/Fatal: {CrashHandler.saveAndPrintLog-58} jav

arcgis runtime for android 100.3開發學習(一)(點、線、面,圖層的建立)

本節我們來學習一下arcgis runtime for android方面的相關內容,一一學習相關方面的api知識。這個案例是摘取github官網上面的。主要建立圖形案例的點、線、面,當然還有圖層的建立。來看一下實現的程式碼。 package com.example.arc

(三) arcgis runtime for android 100.3開發學習(載入影像切片服務)

今天我們來學關於arcgis影像切片服務,注意這個例子的demo比較簡單。我們主要看一下ArcGISMapImageLayer類的UML圖。程式碼是非常簡單的。 來看一下原始碼,非常簡單。 package com.esri.arcgisruntime.sample

(四) arcgis runtime for android 100.3開發學習(載入切片地圖服務)

今天我們來學習關於arcgis for android載入切片地圖服務相關知識。使用的是新版本的arcgis runtime for android100.3,我們來看下載入切片地圖服務的類ArcGISTiledLayer,該類繼承了ImageTiledLayer類,其中Ar

Android Studio 0.5.2中使用ArcGIS Android SDK

環境 作業系統:Mac OSX 10.8.5Android Studio: 0.5.2ArcGIS Android SDK: 10.2.3 操作步驟 在Android Studio中新建一個Module,例如:HelloArcGIS 開啟ArcGIS Android SDK所在資料夾,將libs目