I've 2 classes the 1st one called Font.java and it has the following code
package com.example.font;
package com.example.font;
import android.content.Context;
import android.graphics.Typeface;
public final class Font {
static Context context;
// Font path
static String fontPath = "fonts/font.ttf";
// Loading Font Face
static Typeface tf = Typeface.createFromAsset(context.getAssets(), fontPath);
}
and the second class is an activity and it has the following
package com.example.font;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class AndroidExternalFontsActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// text view label
TextView txtGhost = (TextView) findViewById(R.id.ghost);
// Applying font
txtGhost.setTypeface(Font.tf);
}
}
I would like to set the font which is in Font.java class to to the TextView in the Activity Class.
i tried the above code but it's not working how can i do that ?
thanks.