Note that there are some explanatory texts on larger screens.

plurals
  1. PORuntimeException: native typeface cannot be made
    primarykey
    data
    text
    <p>I'm trying to use a custom font on elements of a listview. So in my ListViewAdapter constructor I have:</p> <pre><code>private Context context; private List&lt;Project&gt; projects; private Typeface tf; public ListViewAdapter(Context context, int resource, List&lt;Project&gt; projects) { super(context, resource, projects); this.context = context; this.projects = projects; tf = getTypefaceForListItems(); } public Typeface getTypefaceForListItems() { return Typeface.createFromAsset(context.getAssets(), "fonts/OpenSans-Regular.ttf"); } </code></pre> <p>In getView method I apply this typeface to a textview. The problem is that I get a Runtime exception: native typeface cannot be made and I don't understand what seems to be the problem.</p> <p>Here's the stacktrace:</p> <pre><code>java.lang.RuntimeException: native typeface cannot be made at android.graphics.Typeface.&lt;init&gt;(Typeface.java:175) at android.graphics.Typeface.createFromAsset(Typeface.java:149) at com.maxcode.clientcheck.ProjectListAdapter.getTypefaceForListItems(ProjectListAdapter.java:41) at com.maxcode.clientcheck.ProjectListAdapter.&lt;init&gt;(ProjectListAdapter.java:25) at com.maxcode.clientcheck.ProjectListActivity$GetProjectsAsyncTask.onPostExecute(ProjectListActivity.java:154) at com.maxcode.clientcheck.ProjectListActivity$GetProjectsAsyncTask.onPostExecute(ProjectListActivity.java:91) at android.os.AsyncTask.finish(AsyncTask.java:631) at android.os.AsyncTask.access$600(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644) 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) </code></pre> <p>Also I wanted to mention that all my fonts are in src/main/assests/fonts folder. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload