Tuesday, October 17, 2017

Using Icon in android project

import android.content.Context;
import android.graphics.Typeface;

import java.util.Hashtable;

/** * Created by Amirul on 17-Oct-17. */
public class Icon_Manager {
    private static Hashtable<String, Typeface> cached_icons = new Hashtable<>();
    public static Typeface get_icons(String path, Context context){
        Typeface icon = cached_icons.get(path);
        if(icon == null){
            icon = Typeface.createFromAsset(context.getAssets(),path);
            cached_icons.put(path,icon);
        }
        return icon;
    }
}



Source