Android Utililty Methods Path Sub Path Get

List of utility methods to do Path Sub Path Get

Description

The list of methods to do Path Sub Path Get are organized into topic(s).

Method

File[]getSubFiles(String parentpath)
get Sub Files
return getSubFiles(parentpath, (String) null);
File[]getSubFiles(String parentpath, FileFilter fileFilter)
get Sub Files
return getSubFiles(parentpath, null, fileFilter);
File[]getSubFiles(String parentpath, String uri)
get Sub Files
File file = null;
if (uri == null || uri.trim().length() == 0) {
    file = new File(parentpath);
} else {
    file = new File(parentpath, uri);
if (!file.exists() || file.isFile())
    return null;
...
File[]getSubFiles(String parentpath, String uri, FileFilter fileFilter)
get Sub Files
File file = null;
if (uri == null || uri.trim().length() == 0) {
    file = new File(parentpath);
} else {
    file = new File(parentpath, uri);
if (!file.exists() || file.isFile())
    return null;
...
booleanhasSubFiles(String path)
has Sub Files
File file = new File(path);
if (!file.exists() || file.isFile())
    return false;
File[] subFiles = file.listFiles(new FileFilter() {
    public boolean accept(File pathname) {
        if (!pathname.isDirectory())
            return true;
        else
...
booleanhasSubFiles(String path, String uri)
has Sub Files
File file = new File(path, uri);
if (!file.exists() || file.isFile())
    return false;
File[] subFiles = file.listFiles(new FileFilter() {
    public boolean accept(File pathname) {
        if (!pathname.isDirectory())
            return true;
        else
...
StringgetLastPathComponent(File file)
get Last Path Component
String[] segments = file.getAbsolutePath().split("/");
String lastPathComponent = segments[segments.length - 1];
return lastPathComponent;
StringgetLastPathComponent(String filePath)
get Last Path Component
String[] segments = filePath.split("/");
String lastPathComponent = segments[segments.length - 1];
return lastPathComponent;
StringgetLastPathComponent(final String filePath)
get Last Path Component
final String[] segments = filePath.split("/");
final String lastPathComponent = segments[segments.length - 1];
return lastPathComponent;
StringgetLastPathComponent(String url)
get Last Path Component
int index = url.lastIndexOf("/");
if (index > 0)
    return url.substring(url.lastIndexOf("/") + 1, url.length());
return url;