What should be used instead of:
StaticLayout layout = new StaticLayout(text, paint, width, Alignment.ALIGN_NORMAL, mSpacingMult, mSpacingAdd, false);
Gives this warning:
warning: [deprecation] StaticLayout(CharSequence,TextPaint,int,Alignment,float,float,boolean) in StaticLayout has been deprecated StaticLayout layout = new StaticLayout(text, paint, width, Alignment.ALIGN_NORMAL, mSpacingMult, mSpacingAdd, false);
Use
StaticLayout.Builder
. Go through here for more details: https://developer.android.com/reference/android/text/StaticLayout.Builderfor your case use: