Mapview ConcurrentModification Exception

by Necroline » Mon, 28 Jun 2010 22:01:55 GMT


Sponsored Links
 ello everyone,

As the title suggest i have (sometimes) a
concurrentmodificationexception while trying to create a route between
two locations ...
Here is my code (and in case you're wondering MyOverlay does not try
to access the other Overlays in the map)

private class fillRouteTask extends AsyncTask<Void, GeoPoint,
Void> {

/**
* create the url to call to get the route
*
* @param src
* @param dest
* @return
*/
private StringBuilder createUrl(GeoPoint src, GeoPoint dest) {
// connect to map web service
StringBuilder urlString = new StringBuilder();

urlString.append("http://maps.google.com/maps?f=d&hl=en");
urlString.append("&saddr=");// from
urlString.append(Double
.toString((double) src.getLatitudeE6()
/ 1.0E6));
urlString.append(",");
urlString.append(Double
.toString((double) src.getLongitudeE6()
/ 1.0E6));
urlString.append("&daddr=");// to
urlString.append(Double
.toString((double) dest.getLatitudeE6()
/ 1.0E6));
urlString.append(",");
urlString.append(Double
.toString((double)
dest.getLongitudeE6() / 1.0E6));
urlString.append("&ie=UTF8&0&om=0&output=kml");
Log.d("xxx", "URL=" + urlString.toString());

return urlString;
}

/**
* create the connection to google url
*
* @param src
* @param dest
* @return
*/
private String connectToUrl(GeoPoint src, GeoPoint dest) {

// get the kml (XML) doc. And parse it to get the
// coordinates(direction
// route).
Document doc = null;
HttpURLConnection urlConnection = null;
URL url = null;
try {
url = new URL(createUrl(src, dest).toString());
urlConnection = (HttpURLConnection)
url.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.setDoOutput(true);
urlConnection.setDoInput(true);
urlConnection.connect();

DocumentBuilderFactory dbf =
DocumentBuilderFactory
.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse(urlConnection.getInputStream());

if
(doc.getElementsByTagName("GeometryCollection") != null



Mapview ConcurrentModification Exception

by Necroline » Mon, 28 Jun 2010 23:42:56 GMT


 ixed it, i removed the Overlays reference from the mapview and it
worked :)


On 28 juin, 16:01, Necroline <adeline.hul...@gmail.com> wrote:

--


Sponsored Links


Other Threads

1. Android API

Hi,

I think the Android developers must spend a few hours in making the
Android API more productive.
There are several points where the developers stucks in the API for
example the ArrayAdapter. Normally you have a display value for
displaying a list or Spinner  and some id-value you want to use
internally (this could be the record _id in the SQLite DB).
I found no possibility to provide a second id-value for the
ArrayAdaper for the Spinner that could be retrieved after the user has
select an item (spinner.setOnItemSelectedListener), Instead of an
meaningfull id-value, I get a sequential  index-value that is not very
usefull.

Regards Michael

--~--~---------~--~----~------------~-------~--~----~

2. Availability of Android Development phone

I've been trying to order an Android development phone. It has not
been available for ordering.
Does anyone know if there are ways to expedite it?
TIA

--~--~---------~--~----~------------~-------~--~----~

3. startActivityForResult problem...

4. wrap around with textview in a tablelayout broken

5. Can we take pictures without setting a camera preview?

6. Can i fetch the latest image from gallery taken from camera ?

7. Convince Dalvik to add a class with the same canonical path as another