File file = new File(getFilesDir(), filename.kml);
InputStream is = new FileInputStream(file);
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int nRead;
byte[] data = new byte[16384];
while ((nRead = is.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, nRead);
}
buffer.flush();
KmlLayer kmlLayer = newKmlLayer(mMap,newByteArrayInputStream(buffer.toByteArray()),getApplicationContext());
kmlLayer.addLayerToMap();
如果我这样编码,它无法正常工作..它会返回错误
java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
W/System.err: at com.google.maps.android.kml.KmlFeatureParser.convertToLatLng(KmlFeatureParser.java:294)
帮我纠正这个问题