include this in your app build.gradle
dependencies {
...
compile 'com.google.maps.android:android-maps-utils:0.4+'
}
This library has the class PolyUtil. I don’t know which Direction JSON parser you are using but I am pretty sure it will have a function that will return you the encoded polyline String. And then use the encoded string like below
public void drawPolyline (){
String polylinePoints = YourParser.getPolylinePoints();
List<LatLng> pointsList = PolyUtil.decode(points);
mMap.addPolyline(new PolylineOptions().width(30).color(android.R.color.black).addAll(pointsList));
}