Java tutorial
//package com.java2s; public class Main { public static String getFileNameFromUri(String uri) { String file = ""; int lastIndexOfSlash = -1; if (uri != null && !uri.isEmpty()) { lastIndexOfSlash = uri.lastIndexOf('/'); if (lastIndexOfSlash > -1) file = uri.substring(uri.lastIndexOf('/'), uri.length()); } return file; } }