Skip to content Skip to sidebar Skip to footer

Android Google Map V3 Polyline Cannot Be Drawn

Getting this error while trying to match PolyLine on Google Map java.lang.NullPointerException: Attempt to read from field 'float com.google.android.gms.maps.model.PolylineOptio

Solution 1:

It looks like polyLineOptions never gets instantiated.

This can happen if routes.size() is 0

Your problem seems to be related to the data passed to the onPostExecute method, so check to see if it's valid and if it was parsed correctly

In any case you should add a check to see if polyLineOptions is null before using it, such as

if (polyLineOptions != null)
{
     googleMap.addPolyline(polyLineOptions);
}

This will make sure you app doesn't crash if there was an error in receiving or parsing the data.

Post a Comment for "Android Google Map V3 Polyline Cannot Be Drawn"