I have made an android app, showing google maps, and on that map i am drawing a polygon whose LatLng is stored in the arrayList.. I want to find the area of that polygon drawn on the google map, I have tried my best, but didn't succeeded, I am unable to use Spherical util, compute area function, as it gives error, please provide me the best help,,,
Thanks in advance, I am providing my code below, plz suggest how to find area of the polygon, being drawn... thanks..
dpackage com.example.mapss;
import java.util.ArrayList;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnMapClickListener;
import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.PolygonOptions;
import com.google.android.gms.maps.model.PolylineOptions;
public class MainActivity extends Activity {
GoogleMap map;
ArrayList<LatLng> arrayPoints =null;
PolylineOptions polylineOptions;
PolygonOptions polygonOptions;
RadioGroup rg_views;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    arrayPoints = new ArrayList<LatLng>();
    map=((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap();
    map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
    map.getUiSettings().setZoomControlsEnabled(true);
    map.getUiSettings().setCompassEnabled(true);
    map.getUiSettings().setMyLocationButtonEnabled(true);
    map.setMyLocationEnabled(true);
    rg_views =(RadioGroup)findViewById(R.id.rg_views);
    rg_views.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            // TODO Auto-generated method stub
            if (checkedId==R.id.rb_map){
                map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
            }
            else if(checkedId==R.id.rb_satellite){
                map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
            }
            else if(checkedId==R.id.rb_terrain){
                map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
            }
        }
    });
    map.setOnMapClickListener(new OnMapClickListener() {
        @Override
        public void onMapClick(LatLng point) {
            // TODO Auto-generated method stub
            MarkerOptions markerOptions = new MarkerOptions();
            markerOptions.position(point);
            markerOptions.title(point.latitude + ": " + point.longitude);
            map.clear();
            map.animateCamera(CameraUpdateFactory.newLatLng(point));
            map.addMarker(markerOptions);
            polygonOptions = new PolygonOptions();
            polygonOptions.fillColor(Color.RED);
            polygonOptions.strokeWidth(5);
            arrayPoints.add(point);
            polygonOptions.addAll(arrayPoints);
            map.addPolygon(polygonOptions);
        }
    });
    map.setOnMapLongClickListener(new OnMapLongClickListener() {
        @Override
        public void onMapLongClick(LatLng point) {
            // TODO Auto-generated method stub
            map.clear();
            arrayPoints.clear();
        }
    });
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}
}