title: How do I get the method name from within that method?
body: <p>I am trying to create a function that returns the method name from within that method:</p>
  
  <pre><code>  public static String getMethodName(final int depth)
    {
      final StackTraceElement[] ste = Thread.currentThread().getStackTrace();
      return ste[ste.length - 1 - depth].getMethodName();
    }
  </code></pre>
  
  <p>However, when I call this method from Activity.onCreate(), it returns "main" instead of "onCreate".</p>
  
  <p>How do I get the actual method name from within that method?</p>