Android アプリケーションの 1 つのボタンで Calibri フォントを使用しようとしています。少し調べてみると、独自の書体を作成する方法がわかりました。しかし、ボタンに書体を設定しようとすると、エラーは発生しませんが、アプリケーションは起動しません。誰もそれを修正する方法を知っていますか?
final Button bt4 = (Button) findViewById(R.id.bt4);
final Typeface font = Typeface.createFromAsset(getAssets(),"CALIBRI.ttf");
bt4.setTypeface(font);
これは、これまでに使用したほとんどすべてのコードです。
そして丸太猫情報
08-29 13:31:20.593: E/global(1143): Deprecated Thread methods are not supported.
08-29 13:31:20.593: E/global(1143): java.lang.UnsupportedOperationException
08-29 13:31:20.593: E/global(1143): at java.lang.VMThread.stop(VMThread.java:85)
08-29 13:31:20.593: E/global(1143): at java.lang.Thread.stop(Thread.java:1280)
08-29 13:31:20.593: E/global(1143): at java.lang.Thread.stop(Thread.java:1247)
08-29 13:31:20.593: E/global(1143): at com.github.TheCad.nijmegen1.SplashScreen$1.run(SplashScreen.java:33)
08-29 13:31:21.553: D/AndroidRuntime(1143): Shutting down VM
08-29 13:31:21.553: W/dalvikvm(1143): threadid=1: thread exiting with uncaught exception (group=0x40015560)
08-29 13:31:21.583: E/AndroidRuntime(1143): FATAL EXCEPTION: main
08-29 13:31:21.583: E/AndroidRuntime(1143): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.github.TheCad.nijmegen1/com.github.TheCad.nijmegen1.MainActivity}: java.lang.RuntimeException: native typeface cannot be made
08-29 13:31:21.583: E/AndroidRuntime(1143): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
08-29 13:31:21.583: E/AndroidRuntime(1143): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
08-29 13:31:21.583: E/AndroidRuntime(1143): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
08-29 13:31:21.583: E/AndroidRuntime(1143): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
08-29 13:31:21.583: E/AndroidRuntime(1143): at android.os.Handler.dispatchMessage(Handler.java:99)
08-29 13:31:21.583: E/AndroidRuntime(1143): at android.os.Looper.loop(Looper.java:123)
08-29 13:31:21.583: E/AndroidRuntime(1143): at android.app.ActivityThread.main(ActivityThread.java:3683)
08-29 13:31:21.583: E/AndroidRuntime(1143): at java.lang.reflect.Method.invokeNative(Native Method)
08-29 13:31:21.583: E/AndroidRuntime(1143): at java.lang.reflect.Method.invoke(Method.java:507)
08-29 13:31:21.583: E/AndroidRuntime(1143): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-29 13:31:21.583: E/AndroidRuntime(1143): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-29 13:31:21.583: E/AndroidRuntime(1143): at dalvik.system.NativeStart.main(Native Method)
08-29 13:31:21.583: E/AndroidRuntime(1143): Caused by: java.lang.RuntimeException: native typeface cannot be made
08-29 13:31:21.583: E/AndroidRuntime(1143): at android.graphics.Typeface.<init>(Typeface.java:147)
08-29 13:31:21.583: E/AndroidRuntime(1143): at android.graphics.Typeface.createFromAsset(Typeface.java:121)
08-29 13:31:21.583: E/AndroidRuntime(1143): at com.github.TheCad.nijmegen1.MainActivity.onCreate(MainActivity.java:25)
08-29 13:31:21.583: E/AndroidRuntime(1143): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-29 13:31:21.583: E/AndroidRuntime(1143): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
08-29 13:31:21.583: E/AndroidRuntime(1143): ... 11 more