com.hippo.unifile.FilenameFilter Java Examples

The following examples show how to use com.hippo.unifile.FilenameFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileActivity.java    From UniFile with Apache License 2.0 6 votes vote down vote up
private void listFilesFilenameFilter() {
    UniFile[] files = mFile.listFiles(new FilenameFilter() {
        @Override
        public boolean accept(UniFile dir, String filename) {
            return filename.startsWith("a");
        }
    });
    if (files == null) {
        Toast.makeText(this, "null", Toast.LENGTH_SHORT).show();
    } else if (files.length == 0) {
        Toast.makeText(this, "empty", Toast.LENGTH_SHORT).show();
    } else {
        ArrayList<Uri> uris = new ArrayList<>();
        for (UniFile f : files) {
            uris.add(f.getUri());
        }
        Intent intent = new Intent(this, FileListActivity.class);
        intent.putParcelableArrayListExtra(FileListActivity.KEY_URIS, uris);
        startActivity(intent);
    }
}