ArrayList<String> fontNames = new ArrayList<String>();
File temp = new File("/system/fonts/");
String fontSuffix = ".ttf";
for(File font : temp.listFiles()) {
String fontName = font.getName();
if(fontName.endsWith(fontSuffix)) {
fontNames.add(fontName.subSequence(0,fontName.lastIndexOf(fontSuffix)).toString());
}
}
In the following code you need to replace fontsname
by the name of the font you would like to use:
TextView lblexample = (TextView) findViewById(R.id.lblexample);
lblexample.setTypeface(Typeface.createFromFile("/system/fonts/" + "fontsname" + ".ttf"));