Returns current method name - Android java.lang.reflect

Android examples for java.lang.reflect:Method

Description

Returns current method name

Demo Code


//package com.java2s;

public class Main {
    /**/*from w  ww . j ava  2  s  . c om*/
     * Returns current method name
     * @return method name
     */
    public static String getCurrentMethod() {
        String methodName = Thread.currentThread().getStackTrace()[1]
                .getMethodName();
        return methodName;
    }
}

Related Tutorials