这是我的TYPEFACE
课
public class TYPEFACE {
public static final Typeface Rupee(Context ctx){
Typeface typeface = Typeface.createFromAsset(ctx.getAssets(), "Rupee_Foradian.ttf");
return typeface;
}
public static final Typeface ArialRounded(Context ctx){
Typeface typeface = Typeface.createFromAsset(ctx.getAssets(), "Rupee_Foradian.ttf");
return typeface;
}
}
我尝试通过以下方式使用反射访问此类中的方法
Method method;
TYPEFACE typeface;
try{
method = typeface.getClass().getMethod("Rupee",Context.class);
}catch(Exception e){
System.out.println("method : "+e);
}
但它会抛出nullpointerexception
.
05-21 17:12:07.026: I/System.out(14917): method : java.lang.NullPointerException
我不知道这种方式有什么问题。有人可以帮助我。
提前致谢。