Hi,
In my game I'm using custom fonts which i read as this:
myFont = Typeface.createFromAsset(appContext.getAssets(), "fonts/
myfont.ttf");
This works ok but reading fonts this way creates a memory leak.
Exiting and reentering the application several times causes an
OutOfMemory exception, and using
adb shell dumpsys meminfo
shows that on each subsequent run, a new font asset is created:
Asset Allocations
zip:/data/app/com.frugalgames.flee.apk:/assets/fonts/LCDM2U__.TTF:
27K
zip:/data/app/com.frugalgames.flee.apk:/assets/fonts/LCDM2U__.TTF:
27K
zip:/data/app/com.frugalgames.flee.apk:/assets/fonts/LCDM2U__.TTF:
27K
I found a bug for this:
http://code.google.com/p/android/issues/detail?id=9904
that suggests reading the font using:
myFont = Typeface.createFromFile(File);
but how can I get the path to the font file in the assets (or
resources, or any inside the apk) folder?
Not sure if it's something obvious, but I tried every possible method
and no luck.
Thanks!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en