0
private class ExtensionFilenameFilter implements FilenameFilter {
private String[] Extensions;
public ExtensionFilenameFilter(String[] extensions) {
super();
Extensions = extensions;
}
public boolean accept(File dir, String filename) {
if (new File(dir, filename).isDirectory()) {
// Accept all directory names
return true;
}
if (Extensions != null && Extensions.length > 0) {
for (int i = 0; i < Extensions.length; i++) {
if (filename.endsWith(".apk")) {
// The filename ends with the extension
return true;
}
}
// The filename did not match any of the extensions
return false;
}
// No extensions has been set. Accept all file extensions.
return true;
}
}
확장자가 .apk
인 파일 만보고 싶습니다.android의 디렉토리에있는 apk 파일 필터링
어떻게 수행하나요? 소스 코드를 명확하게 설명하십시오.
코드에 문제가 있나요? – greenapps