I\'m downloading an ePub file from a URL.
Now I want to implement a mechanism by which if user tries to re-download the same file, he should get warning/error messag
I think using URL#getPath() should simplify things.
public static String getFileNameFromUrl(URL url) { String urlPath = url.getPath(); return urlPath.substring(urlPath.lastIndexOf('/') + 1); }
See, http://developer.android.com/reference/java/net/URL.html#getPath()