Downloadble font is not working perfect with spinner in android

+1 vote
asked Sep 13, 2017 by paras-kathiriya

Here is the adapter code using for spinner.

    public View getCustomView(final int position, View convertView, ViewGroup parent) {

        View vi = convertView;
        final ViewHolder holder;

        if (convertView == null) {
            vi = LayoutInflater.from(context).inflate(R.layout.spinner_row, null);

            holder = new ViewHolder();

        } else {
            holder = (ViewHolder) vi.getTag();

        holder.textview = (TextView) vi.findViewById(;
        holder.textview.setText("Your Text");
        Log.d("holder", fontfamily);
        QueryBuilder queryBuilder = new QueryBuilder(fontfamily);
        String query =;

        FontRequest request = new FontRequest(

        FontsContractCompat.FontRequestCallback callback = new FontsContractCompat
                .FontRequestCallback() {
            public void onTypefaceRetrieved(Typeface typeface) {
                Log.d("holder", "font set for:- " + fontfamily);

                .requestFont(context, request, callback,
        return vi;

Issue is "'fontface' not set with respect to it's 'text'". Not sure but I think it's because of asynchronous.

Thanks is advance for help!!!

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.