Hi I am trying to change the font style of a TextView. I know how to change it, I have done this before I am using the following code.
public class Main_Activity extends ListActivity {
Typeface myNewFace = Typeface.createFromAsset(getAssets(),
"fonts/bediz__.ttf");
private CustomListAdapter adap;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
adap = new CustomListAdapter(this);
setListAdapter(adap);
}
public static class CustomListAdapter extends BaseAdapter implements
Filterable {
public View getView(final int position, View convertView,
ViewGroup parent) {
textView.setText(prayers[position]);
holder.textLine.setTypeface(myNewFace);
}
}
Some of the code I skipped because there is no need, by the way when I access myNewFace in getView() it ask me to make it static, when I make it static like this
static Typeface myNewFace = Typeface.createFromAsset(getAssets(),"fonts/bediz__.ttf");
It gives me the following error
Cannot make a static reference to the non-static method getAssets() from the type ContextWrapper
I dont know what to do, I have done this work several times before but now I dont know why it is not working.