title: Drawing a rectangle on the whole map with Polygon
body: <p>I have been trying to draw a rectangle on the whole map(in a map activity) in Android Studio, i need a delimitation of the equator area, from one part of the map to the other. ( in a big rectangle) But every time i put the coordinates for the rectangle it goes the other way around, so it goes backwards and makes a small square from Pacific ocean to China , Australia and back. </p>
  
  <p>Also, any idea how i can make a button take the shape of a country on the map?</p>
  
  <pre><code>package com.example.android.coffeeknowledge;
  
  import android.content.res.Resources;
  import android.support.v4.app.FragmentActivity;
  import android.os.Bundle;
  import android.util.Log;
  
  import com.google.android.gms.maps.CameraUpdateFactory;
  import com.google.android.gms.maps.GoogleMap;
  import com.google.android.gms.maps.OnMapReadyCallback;
  import com.google.android.gms.maps.SupportMapFragment;
  import com.google.android.gms.maps.model.LatLng;
  import com.google.android.gms.maps.model.MapStyleOptions;
  import com.google.android.gms.maps.model.MarkerOptions;
  import com.google.android.gms.maps.model.Polygon;
  import com.google.android.gms.maps.model.PolygonOptions;
  import com.google.android.gms.maps.model.PolylineOptions;
  
  public class coffeeMap extends FragmentActivity implements OnMapReadyCallback {
  
  private GoogleMap mMap;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_coffee_map);
      // Obtain the SupportMapFragment and get notified when the map is ready to be used.
      SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
              .findFragmentById(R.id.map);
      mapFragment.getMapAsync(this);
  }
  
  /**
   * Manipulates the map once available.
   * This callback is triggered when the map is ready to be used.
   * This is where we can add markers or lines, add listeners or move the camera. In this case,
   * we just add a marker near Sydney, Australia.
   * If Google Play services is not installed on the device, the user will be prompted to install
   * it inside the SupportMapFragment. This method will only be triggered once the user has
   * installed Google Play services and returned to the app.
   */
  private static final LatLng cameraZoom = new LatLng(37.35, -122.0);
  @Override
  public void onMapReady(GoogleMap googleMap) {
      try{
          boolean success = googleMap.setMapStyle(
              MapStyleOptions.loadRawResourceStyle(this, R.raw.mapstyle));
              if(!success){
                  Log.e("coffeeMap","Style parsing failed.");
              }
  
          }catch(Resources.NotFoundException e){
          Log.e("coffeeMap", "Can`t find style.Error: " , e);
      }
  
      mMap = googleMap;
     // Instantiates a new Polygon object and adds points to define a rectangle
      PolygonOptions rectOptions = new PolygonOptions()
              .fillColor(R.color.white)
              .add(new LatLng(24.376368, 101.181309),
                      new LatLng(-28.912738, 103.818027),
                      new LatLng(-26.841671, -117.944509),
                      new LatLng(27.616242, -122.020003),
                      new LatLng(24.376368, 101.181309));
              // Get back the mutable Polygon
      Polygon polygon = mMap.addPolygon(rectOptions);
      // Add a marker in Sydney and move the camera
      //mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(cameraZoom, 13));
      LatLng sydney = new LatLng(35.175321, -107.619365);
      mMap.addMarker(new MarkerOptions().position(sydney).title("Marker"));
   }
   }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6o4Jr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6o4Jr.png" alt="images"></a></p>
  
  <p>Thank you.</p>