text style not work in custom text
<p>this is my custom text class: </p>

<pre><code>public class CustomTXT  extends TextView {


    public CustomTXT(Context context) {
        super(context);
        Typeface face=Typeface.createFromAsset(context.getAssets(), "gandom-bold.ttf");
        this.setTypeface(face);
    }

    public CustomTXT(Context context, AttributeSet attrs) {
        super(context, attrs);
        Typeface face=Typeface.createFromAsset(context.getAssets(), "gandom-bold.ttf");
        this.setTypeface(face);
    }

    public CustomTXT(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        Typeface face=Typeface.createFromAsset(context.getAssets(), "gandom-bold.ttf");
        this.setTypeface(face);
    }

    protected void onDraw (Canvas canvas) {
        super.onDraw(canvas);


    }

}
</code></pre>

<p>but in xml layout when use android:textStyle="bold" for custom text , text style not work!
i try to use set text style programmatically like this : </p>

<pre><code>title = (TextView)view.findViewById(R.id.post_title);
            title.setTypeface(title.getTypeface(), Typeface.BOLD);
</code></pre>

<p>work fine but when become end of recyclerview app crash and give this error :</p>

<pre><code>java.lang.NullPointerException at com.example.erfan.memaraneha.maghalat.DataAdapter$ViewHolder.&lt;init&gt;(DataAdapter.java:94)
</code></pre>

<p>from this line :</p>

<pre><code> title.setTypeface(title.getTypeface(), Typeface.BOLD);
</code></pre>

<p>and this is my adapter :</p>

<pre><code>public class DataAdapter extends RecyclerView.Adapter&lt;DataAdapter.ViewHolder&gt; {
    private Context context;
    List&lt;jsonContent&gt; jcontent;



    public DataAdapter(Context context,List&lt;jsonContent&gt; jcontent) {

        this.context=context;
        this.jcontent=jcontent;
    }

    @Override
    public DataAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {

       View view;
        if(i == R.layout.card_row) {
            view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.card_row, viewGroup, false);
        }else {
            view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.button_card, viewGroup, false);
        }
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(DataAdapter.ViewHolder viewHolder,int i) {


        if(i == jcontent.size()) {
            viewHolder.button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Toast.makeText(context, "Button Clicked", Toast.LENGTH_LONG).show();
                }
            });
        }
        else {

            viewHolder.title.setText(jcontent.get(i).title);

            Picasso.with(context).load(jcontent.get(i).imgurl).resize(300, 400).into(viewHolder.imageView);
        }
    }

    @Override
    public int getItemCount() {

            return jcontent.size()+1;

    }


    @Override
    public int getItemViewType(int position) {
        return (position == jcontent.size()) ? R.layout.button_card : R.layout.card_row;
    }

    public class ViewHolder extends RecyclerView.ViewHolder{

        private TextView title;

        private ImageView imageView;

        private Button button;

        public ViewHolder(final View view) {
            super(view);


           title = (TextView)view.findViewById(R.id.post_title);
            title.setTypeface(title.getTypeface(), Typeface.BOLD);

            imageView=(ImageView)view.findViewById(R.id.img);
            button=(Button)view.findViewById(R.id.loadmore);



            view.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent=new Intent(view.getContext(),card_activity.class);
                    Bundle b = new Bundle();
                    String passingdata = title.getText().toString();
                    b.putString("Key", passingdata);
                    intent.putExtras(b);
                    view.getContext().startActivity(intent);
                }
            });
        }
    }
}
</code></pre>