Try this one.It will be better
String values[]={"2.40744, 77.014702","6.407440, 77.014702","10.4013, 76.951340000000002"};
GoogleMap googleMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SupportMapFragment supportMapFragment = (SupportMapFragment)
getSupportFragmentManager().findFragmentById(R.id.map);
// Getting a reference to the map
googleMap = supportMapFragment.getMap();
for(int i=0;i<values.length;i++)
{
String s[] = values[i].split(",");
String v1 = s[0];
String v2 = s[1];
googleMap.addMarker(new MarkerOptions()
.position(
new LatLng(Double.valueOf(v1),Double.valueOf(v2)))
.title("Hi")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.ic_launcher)));
}
}