Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9252349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:55:22+00:00 2026-06-18T10:55:22+00:00

I have a custom TextView which I’m using in a custom GridView adapter. The

  • 0

I have a custom TextView which I’m using in a custom GridView adapter. The custom TextView is using a custom font for translation purposes. This works fairly well in devices which have the locale installed by default.

However, in devices, in which the language is not installed, it is displaying a strange behavior. When the app loads the first time, the TextViews don’t display with the custom font. However when I press the refresh button to reload the fragment, the TextViews display with the custom font.

I’m not sure why this is happening.

This is happening with all the custom Adapters in my application in which I’m using the custom TextView.

Pretty basic adapter:

public class CalendarWeekAdapter extends BaseAdapter{

    private String[] weekdays;
    Context mContext;
    private LayoutInflater mInflater;

       public CalendarWeekAdapter(Context context, int firstDay)
       {
              mContext=context;
              mInflater = LayoutInflater.from(context);
              weekdays = context.getResources().getStringArray(R.array.weekdays); 
       }
       public int getCount()
       {
              return weekdays.length;
       }
       public Object getItem(int position)
       {
              return position;
       }
       public long getItemId(int position)
       {
              return position;
       }
       public View getView(int position, View convertView, ViewGroup parent)
       {
              ViewHolder holder=null;
              if(convertView==null)
              {
                     convertView = mInflater.inflate(R.layout.calendar_week, parent,false);
                     holder = new ViewHolder();
                     holder.txtWeekdays=(CustomTextView)convertView.findViewById(R.id.weekdays);
                     if(position==0)
                     {                             
                           convertView.setTag(holder);
                     }
              }
              else
              {
                     holder = (ViewHolder) convertView.getTag();
              }


             holder.txtWeekdays.setText(weekdays[position]);


             return convertView;
       }

}
class ViewHolder
{        
          CustomTextView txtWeekdays;                 
}

Basic CustomTextView:

public class CustomTextView extends TextView {
        public CustomTextView(Context context, AttributeSet attrs, int defStyle) {
            super(context, attrs, defStyle);
            init();
        }

        public CustomTextView(Context context, AttributeSet attrs) {
            super(context, attrs);
            init();
        }

        public CustomTextView(Context context) {
            super(context);
            init();
        }

        private void init() {
            if (!isInEditMode()) {
                setTypeface(Utils.getFont(getContext()));
            }
        }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:55:23+00:00Added an answer on June 18, 2026 at 10:55 am

    This is may not be the answer, but i don’t understand this if-statement:

                     holder.txtWeekdays=(CustomTextView)convertView.findViewById(R.id.weekdays);
                     if(position==0)
                     {                             
                           convertView.setTag(holder);
                     }
    

    Why is it there? All your newly inflated convertViews should have holder as their tag.
    Just remove the ‘if’ around the convertView.setTag(holder):

              if(convertView==null)
              {
                     convertView = mInflater.inflate(R.layout.calendar_week, null,false);
                     holder = new ViewHolder();
                     holder.txtWeekdays=(CustomTextView)convertView.findViewById(R.id.weekdays);
                     convertView.setTag(holder);
              }
              ...
    

    and see if this will improve or even fix your situation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom listview by using an adapter which has alternate background color.
I have a custom Chronometer which extends TextView and works as a stopwatch. The
I have ListView with custom Adapter which supplies View to ListView in this way:
I have a Custom ListView which has an ImageView and a TextView. and i
I have a custom ListView in which there are 2 buttons and a textview
I have a custom adapter for my ListView which has multiple TextViews. I want
I have a custom listview which display an image, textview and radio button. I
I have custom adapter with two textviews and one button, which should delete that
I have a custom table cell which basically has 2 buttons, one textview and
I have a custom adapter which formats for me, alphabet headers and then corresponding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.