facebook twitter hatena line email

Android/kotlin/exception

提供: 初心者エンジニアの簡易メモ
2020年3月11日 (水) 15:49時点におけるAdmin (トーク | 投稿記録)による版 (ページの作成:「==stacktraceの方法== <pre> for (i in stackTrace.indices) { Log.i(TAG, "exception className=" + stackTrace[i].className) // クラス名を取得 Log.i(TAG, "ex...」)

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索

stacktraceの方法

for (i in stackTrace.indices) {
    Log.i(TAG, "exception className=" + stackTrace[i].className) // クラス名を取得
    Log.i(TAG, "exception methodName=" + stackTrace[i].methodName) // メソッド名を取得
    Log.i(TAG, "exception fileName=" + stackTrace[i].fileName) // ファイル名を取得
    Log.i(TAG, "exception lineNumber=" + stackTrace[i].lineNumber) // 行番号を取得(nativeメソッドの場合は取得できない)
    Log.i(TAG, "exception isNativeMethod=" + stackTrace[i].isNativeMethod) // nativeメソッドか判定する。
    Log.i(TAG, "exception 整形=" + stackTrace[i]) // スタックトレースの情報を整形して表示
}

参考:https://techacademy.jp/magazine/19050