user2586419
user2586419

Reputation:

Assets folder in android app (eclipse)

I had searched to create the assets folder in an android app, the solution which i had tried is <App Name>/src/assets/fonts/

but when i try to use a ttf file in my Application, i have an error :

the code :

mFace = Typeface.createFromAsset(mContext.getAssets(),"fonts/fontType.ttf");

and the error :

native typeface cannot be made

I don't know if the assets folder is in the good place.

Upvotes: 5

Views: 26575

Answers (4)

Karl Henselin
Karl Henselin

Reputation: 1034

In Android Studio, I tried the root "app" folder, and that didn't work. I looked for the AndroidManifest.xml file and put the assets folder there. That worked for me.

For me it ended up being app\src\main\assets

Upvotes: 2

Seenu69
Seenu69

Reputation: 1054

The assets folder is an independent folder.

While creating an Android project itself the Assets folder is independent to the src folder. Not inside the src folder.

Confirm that assets folder was created in the following way /assets.

Later create a fonts folder inside the assets folder and place fonts file inside the fonts : /assets/fonts

Upvotes: 0

Pankaj Kumar
Pankaj Kumar

Reputation: 83028

The problem is at the path of asset

<App Name>/src/assets/fonts/

should be

<App Name>/assets/fonts/

Read more at Directory Structure of an Android Project


Android project directory structure is as below

enter image description here

Upvotes: 16

silvia_aut
silvia_aut

Reputation: 1493

ProjectName/assets/fonts

Not in under the src.

Upvotes: 1

Related Questions