Can i use callout to put comments on the map?

3476
4
Jump to solution
05-25-2015 08:14 AM
thizu
by
New Contributor

I'm just new to ArcGIS sdk with Android.I want to input some text on the map after tap a location on the map.After i input that if i tap on another location the text should minimize like on callout?I want to ask whether i can use callout for this purpose or is there any other method which i can use? Please help me. Thank you

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ShellyGill1
Esri Contributor

I think you should be able to use an EditText in a callout to allow a user to add text, although I have not tried it I dont know any reason why that would not work just fine. You would then need to add a Graphic with that information to a GraphicsLayer, so you can show the marker at the location added. There is only one Callout per map so you would need to consider that when you code, and change the callout content when required.  - text could be added as an attribute on the Graphic so that if the user clicks back on the point they added before, you can display that in the callout. However, when thinking about users entering text it would be more typical I think to simply show a text input UX in some other way, like a separate fragment or activity, or in a dialog that shows up over the activity that contains the map (especially on a small phone screen). The callout is typically used to display data, not for entering data.

Also, you might want to think about how the information is saved after the user has entered it. If the data the users enter need to be saved just for themselves, you can persist the information yourself using the typical Android pattern. But if you want to save the information and make it available to other people, you could look instead at getting an AGOL subscription and making an editable feature service, and adding that as a FeatureLayer in your map, with popups.

View solution in original post

4 Replies
ShellyGill1
Esri Contributor

It sounds like a callout suits your purposes. Callouts are normally shown when a user taps on a map, to show any kind of information you want to show - just call MapView.getCallout() to get the callout instance (there is only one callout for each map), set the View of the callout to show the info you want by calling setContent(View), then call show or animatedShow methods. If you tap on another location that doesnt have any information, you can just hide the callout by calling hide or animatedHide.

Customize the callout—ArcGIS Runtime SDK for Android | ArcGIS for Developers

If you want to show information about the features in the layers in your map (their attributes), when a user taps on the feature, you might want to look at using pop-ups instead - the easiest way to start using popups is by using MapViewHelper.createPopup method, that is part of the Application Toolkit:

Application Toolkit for ArcGIS Android—ArcGIS Runtime SDK for Android | ArcGIS for Developers https://developers.arcgis.com/android/guide/view-pop-ups.htm

If you want to show text permanently on the map (like a label), then you can do that as well:

Add graphics and text—ArcGIS Runtime SDK for Android | ArcGIS for Developers

Hope this helps,

Shelly

thizubu
New Contributor

Thank you so much. Here in my case i want to add text by the user inputs. not hard coded texts. In my app if user wants to add some special notes on a point then he wants to get textview(can i use callout for that? ) and write the things he wants.when he locates another point, the text should hide and only simple marker  display on the map to identify point which added text.

0 Kudos
ShellyGill1
Esri Contributor

I think you should be able to use an EditText in a callout to allow a user to add text, although I have not tried it I dont know any reason why that would not work just fine. You would then need to add a Graphic with that information to a GraphicsLayer, so you can show the marker at the location added. There is only one Callout per map so you would need to consider that when you code, and change the callout content when required.  - text could be added as an attribute on the Graphic so that if the user clicks back on the point they added before, you can display that in the callout. However, when thinking about users entering text it would be more typical I think to simply show a text input UX in some other way, like a separate fragment or activity, or in a dialog that shows up over the activity that contains the map (especially on a small phone screen). The callout is typically used to display data, not for entering data.

Also, you might want to think about how the information is saved after the user has entered it. If the data the users enter need to be saved just for themselves, you can persist the information yourself using the typical Android pattern. But if you want to save the information and make it available to other people, you could look instead at getting an AGOL subscription and making an editable feature service, and adding that as a FeatureLayer in your map, with popups.

View solution in original post

thizu
by
New Contributor

mmm Got the idea.. Really thank you so much. 

0 Kudos