Java tutorial
//package com.java2s; //License from project: Apache License import java.io.File; import android.text.TextUtils; public class Main { public static String getFileNameNoTensionByPath(final String path) { String fileName = getFileNameFromPath(path); if (TextUtils.isEmpty(fileName)) { return fileName; } int nFind = fileName.indexOf('.'); if (nFind > 0) { return fileName.substring(0, nFind); } return ""; } public static String getFileNameFromPath(final String path) { if (TextUtils.isEmpty(path)) { return path; } String[] arr = path.split(File.separator); return arr.length == 0 ? "" : arr[arr.length - 1]; } }