StackTraceElement[] telements = new Exception().getStackTrace();
String callerClass = telements[1].getClassName();
String callerMethod = telements[1].getMethodName();
The array's 0th item is your method and 1st item is the method that called your method.

No comments:
Post a Comment