Android examples for java.lang:Class
get Class Name
public class Main { public static String getClassName() { try {/*from w w w . ja va 2 s . c o m*/ String fullClassName = new Exception().getStackTrace()[1].getClassName(); return fullClassName.substring(fullClassName.lastIndexOf(".") + 1); } catch (Exception ex) { return "UnknownClass"; } } }