//add the code below to set a listener that will be called when the MapView is initialized.
// You will check this in a later step to see if the map is ready for a user to make queries.
Use the extent of the resulting Polygon as the new extent for your MapView.
That might be one way to do it.
You might also be able to call merge(), merging each Envelope with the next until you've merged them all.