On Feb 11, 2013, at 6:12 PM, Hulot <cahu...@hotmail.com> wrote:
> Any news on this problem? I´m getting exception as well when using : tf = 
> Typeface.CreateFromAsset(context.Assets, "fonts/somefont.ttf");

It would help matters if the stack trace were nicely formatted and readable [0].

The problem is that Android is throwing a java.lang.RuntimeException. Beyond 
that, you'd need to investigate further:

        
https://github.com/android/platform_frameworks_base/blob/master/graphics/java/android/graphics/Typeface.java#L175
        
https://github.com/android/platform_frameworks_base/blob/master/graphics/java/android/graphics/Typeface.java#L149

Looks like Typeface.nativeCreateFromAsset() is returning an "invalid" value:

        
https://github.com/android/platform_frameworks_base/blob/master/core/jni/android/graphics/Typeface.cpp#L115

Unfortunately it doesn't look like it prints anything to logcat to explain 
_why_ it's returning an error value; my initial guess is that either 
context.Assets is null (weird?) or you don't have an Assets\fonts\somefont.ttf 
file with a build action of AndroidAsset.

 - Jon

[0]: Java.Lang.RuntimeException: native typeface cannot be made
  at Android.Runtime.JNIEnv.CallStaticObjectMethod 
(intptr,intptr,Android.Runtime.JValue[]) [0x00024] in 
/Users/builder/data/lanes/monodroid-mac-monodroid-4.4-series/6418373f/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:767
 
  at Android.Graphics.Typeface.CreateFromAsset 
(Android.Content.Res.AssetManager,string) [0x00034] in 
/Users/builder/data/lanes/monodroid-mac-monodroid-4.4-series/6418373f/source/monodroid/src/Mono.Android/platforms/android-16/src/generated/Android.Graphics.Typeface.cs:201
 
  at CalculatorTest.Activity1.OnCreate (Android.OS.Bundle) [0x00063] in 
c:\Users\HulotDev\Documents\Projects\CalculatorTest\CalculatorTest\Activity1.cs:47
 
  at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) 
[0x00010] in 
/Users/builder/data/lanes/monodroid-mac-monodroid-4.4-series/6418373f/source/monodroid/src/Mono.Android/platforms/android-16/src/generated/Android.App.Activity.cs:1997
 
  at (wrapper dynamic-method) object.18cd6642-1f38-4c84-8e6a-e3b8d7ce86f9 
(intptr,intptr,intptr)
--- End of managed exception stack trace ---
java.lang.RuntimeException: native typeface cannot be made 
  at android.graphics.Typeface.(Typeface.java:175)
  at android.graphics.Typeface.createFromAsset(Typeface.java:149)
  at calculatortest.Activity1.n_onCreate(Native Method)
  at calculatortest.Activity1.onCreate(Activity1.java:28)
  at android.app.Activity.performCreate(Activity.java:5008)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
  at android.app.ActivityThread.access$600(ActivityThread.java:130)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:4745)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  at dalvik.system.NativeStart.main(Native Method)

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to