We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d9f7845 commit 11472c3Copy full SHA for 11472c3
support-android/src/main/java/com/am/tool/support/utils/UriUtils.java
@@ -26,6 +26,7 @@
26
import java.io.File;
27
import java.io.FileInputStream;
28
import java.io.FileOutputStream;
29
+import java.util.List;
30
31
/**
32
* Uri 工具
@@ -120,4 +121,17 @@ public static String getName(Context context, Uri uri) {
120
121
return null;
122
}
123
124
+
125
+ /**
126
+ * 获取名称
127
+ *
128
+ * @param uri 链接
129
+ * @return 名称
130
+ */
131
+ @Nullable
132
+ public static String getNameByPath(Uri uri) {
133
+ final List<String> segments = uri.getPathSegments();
134
+ return (segments == null || segments.isEmpty()) ?
135
+ null : segments.get(segments.size() - 1);
136
+ }
137
0 commit comments