Java tutorial
//package com.java2s; import android.support.annotation.NonNull; import java.io.File; public class Main { private static final String FILE_PROTOCOL = "file://"; /** * Build an URL from a file name. * * @param file a local file name * @return an URL with the <tt>file</tt> scheme */ @NonNull public static String fileToUrl(final File file) { return FILE_PROTOCOL + file.getAbsolutePath(); } }