0

I want to write the number in alternate fraction.

1
_<BR>
2

instead of 1/2. for this purpose I used the code

Typeface typeface = Typeface.createFromAsset(getAssets(), "Nutso2.otf");
vText.setTypeface(typeface);

vText.setText("1/2");
vText.setFontFeatureSettings("afrc");

but I am getting this error

com.example.kashif.equationsolver E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.kashif.equationsolver, PID: 4746
    java.lang.NoSuchMethodError: android.widget.TextView.setFontFeatureSettings
            at  com.example.kashif.equationsolver.MainActivity$3.onClick(MainActivity.java:331)
            at android.view.View.performClick(View.java:4438)
            at android.view.View$PerformClick.run(View.java:18422)
            at android.os.Handler.handleCallback(Handler.java:733)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5001)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
Rohit Gupta
  • 4,022
  • 20
  • 31
  • 41

1 Answers1

0

setFontFeatureSettings is sadly only available from Lollipop (21) onwards, you can't use it before!

Takhion
  • 2,706
  • 24
  • 30