i want to draw path on google map.
Basically what i am tracking user locaion after specfic time interval. when user reach to some destination then i need to draw the path which he followed to reach that destination.
It is working fine but the problem is it is showing zigzag path. See the image below.
What i want:
I want to draw a proper path followed by the points that i get during tracking.
What i have tried
i searched and found this link in which we can pass up to 8 points to get the directions. Which is the maximum limit allowed to the non-business users of the Google Map. Is there any other way to achieve this. because i have so many points to draw on map.
code for drawing polylines
private void drawPath() {
        if (mMap != null)
            mMap.clear();
        int count = 0;
        LatLng prev = null;
        String[] mProjection = {LocTable.COLUMN_ID, LocTable.COLUMN_LONGITUDE, LocTable.COLUMN_LATITUDE};
        String mSelectionClause = LocTable.COLUMN_ID + "> ?";
        String[] mSelectionArgs = {"0"};
        String mSortOrder = LocTable.COLUMN_ID;
        Cursor mCursor = getContentResolver().query(
                LocContentProvider.CONTENT_URI,   // The content URI of the words table
                mProjection,                        // The columns to return for each row
                mSelectionClause,                    // Selection criteria
                mSelectionArgs,                     // Selection criteria
                mSortOrder); 
        if(mCursor != null && mCursor.getCount()!=0) {
            Log.i("cursor", "Count: " + mCursor.getCount() + "|Column count: " + mCursor.getColumnCount());
            if (mCursor.moveToFirst()) {
                do {
                    if (mMap != null) {
                        float lon = mCursor.getFloat(1);
                        float lat = mCursor.getFloat(2);
                        LatLng current = new LatLng(lat, lon);
                        markerPoints.add(current);
                        if (count == 0){
                            prev = current;
                        }
                        CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(current, 19);
                        mMap.animateCamera(cameraUpdate);
                        mMap.addPolyline((new PolylineOptions())
                                .add(prev, current).width(6).color(Color.BLUE)
                                .visible(true));
                        prev=current;
                        count++;
                    }
                } while (mCursor.moveToNext());
            }
            mCursor.close();
        }
    }

 
     
     
     
     
    