Posts

Showing posts from March 5, 2019

Android - Removing markers when changing different maps

Image
0 I have created an app that displays different tracks in a park. I have created two markers which represent the start and end of the track. I am getting a problem where when I change tracks, the marker from the previous track still shows. I tried map.clear() but that removed everything. I want to not show the markers from the previous track. private void createMarker(double latitude, double longitude, String title) { map.addMarker(new MarkerOptions() .position(new LatLng(latitude, longitude)) .title(title) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW))); } private void updateMapTrack() { switch (options.getTrack()) { case TRACK1: createMarker(-45.85696303760779, 170.5199563062967, "Start of track1.&q

Method toJSONObject of org.json.XML cannot hold capitalized accented letters

Image
1 I'm having an XML to JSON transformation issue. It happens that I'm trying to transform an XML string into a JSONObject using method toJSONObject of class org.json.XML . The thing is that such method does not hold accented capital letters during the transformation. For example, if the XML contains the word “HellÓ”, it transforms it to “Helló” in the JSON. It holds the accent, but not the capital letter. In my code I got: import org.json.JSONException; import org.json.JSONObject; import org.json.XML; ... try { JSONObject xmlJSONObj = XML.toJSONObject(this.xmlString); ... } Any recommendations to solve this problem using this same library? java json xml share | improve this qu