Android examples for java.lang:Class
get Class Path from Class<?>
public class Main{ public static final String getClassPath(Class<?> value) { if (value == null) { return null; }// ww w . j a v a 2 s. c om char[] temp = value.getName().toCharArray(); for (int i = value.getPackage() == null ? 0 : value.getPackage() .getName().length() + 1; i < temp.length; i++) { if (temp[i] == '.') { temp[i] = '$'; } } return new String(temp); } }