org.sqldroid.DebugPrinter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of SQLDroid Show documentation
Show all versions of SQLDroid Show documentation
SQLDroid with some performance improvements
The newest version!
package org.sqldroid;
/**
* thanks to
* http://blog.taragana.com/index.php/archive/core-java-how-to-get-java-source-code-line-number-file-name-in-code/!
*
* @author klm
*
*/
public class DebugPrinter {
// original tutorial suggests items [2]
// from arrays, but [3] works for android.
// there you go..
/** Get the current line number.
* @return int - Current line number.
*/
public static int getLineNumber() {
return Thread.currentThread().getStackTrace()[3].getLineNumber();
}
public static String getFileName() {
return Thread.currentThread().getStackTrace()[3].getClassName()
+ " (" + Thread.currentThread().getStackTrace()[3].getMethodName() + ")";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy