android-maps-utils icon indicating copy to clipboard operation
android-maps-utils copied to clipboard

Incompatible types List of List and ArrayList of ArrayList

Open kaoutarFa opened this issue 9 years ago • 2 comments

Hello everybody, I am using google maps api to display a kml layer ... after rebuilding the project I got an issue in the google maps api's java file KmlPolygonTest.java ... in this function :

public KmlPolygon createRegularPolygon() { ArrayList<LatLng> outerCoordinates = new ArrayList<LatLng>(); outerCoordinates.add(new LatLng(10, 10)); outerCoordinates.add(new LatLng(20, 20)); outerCoordinates.add(new LatLng(30, 30)); outerCoordinates.add(new LatLng(10, 10)); ArrayList<ArrayList<LatLng>> innerCoordinates = new ArrayList<ArrayList<LatLng>>(); ArrayList<LatLng> innerHole = new ArrayList<LatLng>(); innerHole.add(new LatLng(20, 20)); innerHole.add(new LatLng(10, 10)); innerHole.add(new LatLng(20, 20)); innerCoordinates.add(innerHole); return new KmlPolygon(**outerCoordinates**, **innerCoordinates**); } specifically at words in bold ... the compiler says :

"Error:(30, 49) error: incompatible types: ArrayList<ArrayList> cannot be converted to List<List> Error:Execution failed for task ':lib:library:compileDebugAndroidTestJavaWithJavac'.

Compilation failed; see the compiler error output for details. " here is a screenshot..

untitled

kaoutarFa avatar Apr 30 '17 08:04 kaoutarFa

You should be able to fix this by changing your ArrayList declarations to just List. See https://github.com/googlemaps/android-maps-utils/commit/9be09a2e4a77a222d62d5719bcaa6413dcf373f6 for an example. If that doesn't work, let us know!

barbeau avatar Apr 30 '17 13:04 barbeau

it worked thank u :)

kaoutarFa avatar Apr 30 '17 15:04 kaoutarFa