Getting system font names
suggest changeArrayList<String> fontNames = new ArrayList<String>();
File temp = new File("/system/fonts/");
String fontSuffix = ".ttf";
File[] files = temp.listFiles();
if (files == null) {
return fontNames;
}
for (File font : files) {
String fontName = font.getName();
if(fontName.endsWith(fontSuffix)) {
fontNames.add(fontName.subSequence(0,fontName.lastIndexOf(fontSuffix)).toString());
}
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents