I wish to center my map to my geojsonLayer. So far I have :
GeoJsonLayer layer = new GeoJsonLayer(mymap,geojson);
layer.affLayerToMap();
LatLngBounds bounds = layer.getBoundingBox();
mymap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
but the bounds is null even though the layer is set to the map
layer.isLayerOnMap // Return true
According to the documentation of the getBoundingBox() method (and by looking at the code), you'll see that the boundingBox has a value only when there is a FeatureCollection in your geojson (so it won't work with a simple polygon or a line). Also, It seems that it won't work at all if there is no "bbox" property in the geojson, I did not see any mecanism in the code that actually go through each coordinates and save a bounding box.
I suggest parsing the coordinates yourself using the LatLngBounds.Builder
.