Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fonts are not in library #7

Closed
spacecowboy opened this issue Apr 18, 2013 · 2 comments
Closed

Fonts are not in library #7

spacecowboy opened this issue Apr 18, 2013 · 2 comments

Comments

@spacecowboy
Copy link

The library project is missing the asset folder. They are in the sample project instead.

Gives rise to nice errors like this :)

E/AndroidRuntime(25996): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class com.doomonafireball.betterpickers.timepicker.TimerView
E/AndroidRuntime(25996): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
E/AndroidRuntime(25996): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
E/AndroidRuntime(25996): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
E/AndroidRuntime(25996): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
E/AndroidRuntime(25996): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
E/AndroidRuntime(25996): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
E/AndroidRuntime(25996): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
E/AndroidRuntime(25996): at com.doomonafireball.betterpickers.timepicker.TimePicker.(TimePicker.java:70)
E/AndroidRuntime(25996): ... 24 more
E/AndroidRuntime(25996): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime(25996): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime(25996): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
E/AndroidRuntime(25996): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
E/AndroidRuntime(25996): ... 31 more
E/AndroidRuntime(25996): Caused by: java.lang.RuntimeException: native typeface cannot be made
E/AndroidRuntime(25996): at android.graphics.Typeface.(Typeface.java:175)
E/AndroidRuntime(25996): at android.graphics.Typeface.createFromAsset(Typeface.java:149)
E/AndroidRuntime(25996): at com.doomonafireball.betterpickers.timepicker.TimerView.(TimerView.java:31)
E/AndroidRuntime(25996): ... 34 more

@derekbrameyer
Copy link
Contributor

Yup, unfortunately that's just a platform limitation at the moment. You can package them into your app's assets/fonts folder (or create one if it doesn't have one right now) and it'll work correctly.

I may explore adding the fonts to res/raw and doing decoding there, but that would make the library a bit bloated.

Some relevant discussion here: http://stackoverflow.com/questions/6346889/how-to-reference-an-asset-in-a-library-project

@spacecowboy
Copy link
Author

Thanks for the quick reply. Just after posting this I noticed that copying them into the library's asset folder did not alleviate the issue. Moving them into my own app's asset folder worked nicely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants