Created
July 15, 2015 01:12
-
-
Save yeojoy/94fc16bacb274e9bb638 to your computer and use it in GitHub Desktop.
Android Log line number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void show() { | |
StringBuilder sb = new StringBuilder(); | |
StackTraceElement ste = null; | |
int j = Thread.currentThread().getStackTrace().length; | |
for (int index = 0; index < j; index++) { | |
ste = Thread.currentThread().getStackTrace()[index]; | |
if (ste == null) continue; | |
// ste 내부 내용 출력. | |
sb.append("index : ").append(index).append("\n"); | |
sb.append("Class Name : ").append(ste.getClassName()).append("\n"); | |
sb.append("File Name : ").append(ste.getFileName()).append("\n"); | |
sb.append("Line Number : ").append(ste.getLineNumber()).append("\n"); | |
sb.append("Method Name : ").append(ste.getMethodName()).append("\n"); | |
sb.append("isNativeMethod : ").append(ste.isNativeMethod()).append("\n"); | |
sb.append("toString() : ").append(ste.toString()).append("\n\n\n"); | |
} | |
((TextView) findViewById(R.id.tv_result)).setText(sb); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment