Road Directions

how to detect road detections in android using graphhopper?

Do you mean road directions in the sense of towards direction you are currently heading? If you are using GraphHopper offline or the Java client of our Directions API you can use InstructionList.find(lat,lon,maxDist) and then calculate the heading via

    /**
     * Calculate the azimuth in degree for a line given by two coordinates. Direction in 'degree'
     * where 0 is north, 90 is east, 180 is south and 270 is west.
     */
    double calcAzimuth(double lat1, double lon1, double lat2, double lon2) {
        double orientation = -calcOrientation(lat1, lon1, lat2, lon2);
        orientation = Helper.round4(orientation + Math.PI / 2);
        if (orientation < 0)
            orientation += 2 * Math.PI;

        return Math.toDegrees(orientation);
    }

Thanks you very much for your quick response.

Sorry for not explaining my issue very well. Actually i have to optimize route by detecting invalid waypoints/vias from the given data of client, So basically i want to implement any method that will accept single lat/lon and provide me the direction of road (e.g. This road is to go ahead or to come back).
Means: This way (->) or (<-).

Many Thanks,

As single coordinates all contain measurement errors and therefor make the direction detection very hard I suggest looking at the Map Matching API which allows you to put in multiple points.