“setTypeface”的正确位置,以避免内存泄漏

时间:2014-02-08 12:18:37

标签: android

在listview上使用setTypeface的正确位置是什么? 在我检查logcat的那一刻,我看到这条消息“Purgin 192K from font cache [23 enrtries] 这有点内存泄漏吗? 和我的代码:

 final Typeface FontText =  FontFactory.getFontfromRaw();
    public View getView(final int position, View convertView, ViewGroup parent) {
        try {
.....
     Textbox.setTypeface(FontText)

和我的FontFactory类:

public class FontFactory {

private static FontFactory instance = new FontFactory ();

private FontFactory () {}

public static FontFactory getInstance() {
return instance;
}

public static Typeface getFontfromRaw() {
return Typeface.createFromAsset(AppContext.getAppContext().getResources().getAssets(), "fonts/myfont.ttf");
}
}

0 个答案:

没有答案