Hi!
I'm currently developing an Android application with information provided by this feature table and I want the markers to display pop-ups like the following one when touched:
Could someone tell me how I can do that, please? I'm doing this but I'm getting an exception (ArcGISRuntimeException) when the ninth line is executed:
Thanks in advance!
Solved! Go to Solution.
Hi again!
Finally I solved the problem using Callout instead of Popup like in this example because doing that I don't need a PopupDefinition or the fields defined on the FeatureTable since I obtain the required information using ServiceFeatureTable's method queryFeaturesAsync().
What is the full error that you are getting?
This is the error that I'm getting in first place when I'm debugging the application:
"com.esri.arcgisruntime.ArcGISRuntimeException:Cannot call this method in this context".
I must point out that I'm trying creating a new PopupDefinition because, when I create the feature layer from the feature table, according to the debugger it has no PopupDefinition set and it seems rare to me because in the browser I can see the pop-ups without problem like in the first image.
Can you upload the smallest reproducible case you have? I may be able to figure out what is going on if I have more code.
Of course! I have uploaded a reduced version of the application here.
Rather than construct a new popupdefinition, have you tried just grabbing the existing one from the feature layer:
PopupDefinition popupDefinition = featureLayer.getPopupDefinition();
Yes, I'm try to construct a new PopupDefinition because when I try to grab the existing one it's value is "null" according to the debugger:
It seems that the feature layer is not getting that field from the feature table and I don't know if it's happening because I'm doing something wrong or because the feature server hasn't that information defined.
I see what you are saying. My assumption is that the feature server does not have that information defined. I ran into something similar to this the other day and was really blocked by it. If I get some time later today, I will investigate more on my end and see if I can come up with a working sample to figure out what might be going wrong here.
Hi again!
Finally I solved the problem using Callout instead of Popup like in this example because doing that I don't need a PopupDefinition or the fields defined on the FeatureTable since I obtain the required information using ServiceFeatureTable's method queryFeaturesAsync().
I am glad you were able to get it working for you. I went and did some work with popups this past week and while it is not perfect, I think you may find aspects of it useful in your work:
GitHub - nohe427/KtPopup: Kotlin Popups
I hope this helps!
Alexander