I have a custom font which is displaying the box character. The font I am using does not support all languages apparently. I want to check if the String I am about to displa
For those of you who would still like your app to be compatible with APIs less than 23 and still use the hasGlyph function in your code, you can use the @TargetApi(23) in the following way:
@TargetApi(23)
public boolean isPrintable( String c ) {
Paint paint=new Paint();
boolean hasGlyph=true;
hasGlyph=paint.hasGlyph(c);
return hasGlyph;
}
And then in your code:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if(isPrintable(yourString)) {
//Do Something
}
}
The only problem is that in APIs lower than 23, your app may show blank symbols. But at least in API23+ your app will be perfect.