# How can I add a marker in the center of the route in Google Maps API Android

I am doing an Android project that takes the input as source and destination latitudes and longitudes, and adds a marker in exactly half the distance of the of the route.

For doing this, I get the distance of the route with this code:

``public double CalculationByDistance(GeoPoint StartP, GeoPoint EndP) {int Radius=6371;//radius of earth in Kmdouble lat1 = StartP.getLatitudeE6()/1E6;double lat2 = EndP.getLatitudeE6()/1E6;double lon1 = StartP.getLongitudeE6()/1E6;double lon2 = EndP.getLongitudeE6()/1E6;double dLat = Math.toRadians(lat2-lat1);double dLon = Math.toRadians(lon2-lon1);double a = Math.sin(dLat/2) * Math.sin(dLat/2) +Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) *Math.sin(dLon/2) * Math.sin(dLon/2);double c = 2 * Math.asin(Math.sqrt(a));double valueResult= Radius*c;double km=valueResult/1;DecimalFormat newFormat = new DecimalFormat("####");kmInDec = Integer.valueOf(newFormat.format(km));meter=valueResult%1000;meterInDec= Integer.valueOf(newFormat.format(meter));Log.i("Radius Value",""+valueResult+" KM "+kmInDec+" Meter "+meterInDec);return Radius * c;}``

Can I use the Interpolate method of the SphericalUtil class to add the marker, or is there any easier way to do it?

Note: I cannot use Javascript as a part of my project. So please suggest a way of doing it in Android only! :D