Display pop-up when a marker is touched (SDK 100.0.0)

2039
9
Jump to solution
05-22-2017 12:04 PM
DarwinHamad
New Contributor II

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!

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
DarwinHamad
New Contributor II

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().

View solution in original post

0 Kudos
9 Replies
AlexanderNohe1
Occasional Contributor III

What is the full error that you are getting?

0 Kudos
DarwinHamad
New Contributor II

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.

0 Kudos
AlexanderNohe1
Occasional Contributor III

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.

0 Kudos
DarwinHamad
New Contributor II

Of course! I have uploaded a reduced version of the application here.

0 Kudos
AlexanderNohe1
Occasional Contributor III

Rather than construct a new popupdefinition, have you tried just grabbing the existing one from the feature layer:

PopupDefinition popupDefinition = featureLayer.getPopupDefinition();
0 Kudos
DarwinHamad
New Contributor II

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.

0 Kudos
AlexanderNohe1
Occasional Contributor III

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.

DarwinHamad
New Contributor II

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().

0 Kudos
AlexanderNohe1
Occasional Contributor III

Darwin Hamad‌,

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