get Class Name for object - Android java.lang

Android examples for java.lang:Class

Description

get Class Name for object

Demo Code


public class Main{

    public static String getClassName(Object obj) {
        String arrays[] = obj.getClass().getName().split("\\.");
        return arrays[arrays.length - 1];
    }//from   w ww .  ja  va 2 s .  co m

}

Related Tutorials