共用方式為


Throwable.GetStackTrace Method

Definition

Provides programmatic access to the stack trace information printed by #printStackTrace().

[Android.Runtime.Register("getStackTrace", "()[Ljava/lang/StackTraceElement;", "GetGetStackTraceHandler")]
public virtual Java.Lang.StackTraceElement[] GetStackTrace ();
[<Android.Runtime.Register("getStackTrace", "()[Ljava/lang/StackTraceElement;", "GetGetStackTraceHandler")>]
abstract member GetStackTrace : unit -> Java.Lang.StackTraceElement[]
override this.GetStackTrace : unit -> Java.Lang.StackTraceElement[]

Returns

an array of stack trace elements representing the stack trace pertaining to this throwable.

Attributes

Remarks

Provides programmatic access to the stack trace information printed by #printStackTrace(). Returns an array of stack trace elements, each representing one stack frame. The zeroth element of the array (assuming the array's length is non-zero) represents the top of the stack, which is the last method invocation in the sequence. Typically, this is the point at which this throwable was created and thrown. The last element of the array (assuming the array's length is non-zero) represents the bottom of the stack, which is the first method invocation in the sequence.

Some virtual machines may, under some circumstances, omit one or more stack frames from the stack trace. In the extreme case, a virtual machine that has no stack trace information concerning this throwable is permitted to return a zero-length array from this method. Generally speaking, the array returned by this method will contain one element for every frame that would be printed by printStackTrace. Writes to the returned array do not affect future calls to this method.

Added in 1.4.

Java documentation for java.lang.Throwable.getStackTrace().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also