I'm trying to change the font on my navigationdrawer, I'm using a custom xml file with the adapter so I can change successfully the color and background of each element within the ListView, nevertheless I can't change the Typeface, AndroidStudio is giving me a null object reference so, I think it hasn't found the textview. My code:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mDrawerListView = (ListView) inflater.inflate(
R.layout.fragment_navigation_drawer, container, false);
TextView lbl = (TextView) mDrawerListView.findViewById(R.id.section_label);
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"fonts/Jaapokki-Regular.otf");
lbl.setTypeface(tf);
mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
selectItem(position);
}
});
mDrawerListView.setAdapter(new ArrayAdapter<String>(
getActionBar().getThemedContext(),
R.layout.fragment_main,
R.id.section_label,
new String[]{
getString(R.string.title_section1),
getString(R.string.title_section2),
getString(R.string.title_section3),
"Acerca de...",
}));
mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
return mDrawerListView;
}
Thanks so much!