Java Reflection in android -


this typeface class

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;     }  } 

and try access methods class using reflection following way

method method; typeface typeface; try{                 method = typeface.getclass().getmethod("rupee",context.class); }catch(exception e){     system.out.println("method : "+e); } 

but throws nullpointerexception.

05-21 17:12:07.026: i/system.out(14917): method : java.lang.nullpointerexception 

i dont know wrong way. sombody can me please.

thanks in advance.

typeface null, because it's not initialized

change typeface typeface = new typeface();


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -