android: 根据文件uri 获取文件名
public static String getFileRealNameFromUri(Context context, Uri fileUri) { if (context == null || fileUri == null) return null; DocumentFile documentFile = DocumentFile.fromSingleUri(context, fileUri); if (documentFile == null) return null; return documentFile.getName(); }
See:
1. ContentResolver - 如何从Uri获取文件名
2. StackOverFlow: Get filename and path from URI from mediastore