// code from http://yuncode.net/codes/ String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();