I need to get calling method name and line number in android,I tried with
Thread.currentThread().getStackTrace()[2].getMethodName())
but this will give called method name,but I need to print calling method name,can anyone help me in solving this.
For the class name
this.getClass().getName();
For line number
Thread.currentThread().getStackTrace()[1].getLineNumber();
and the method would be
Thread.currentThread().getStackTrace()[1].getMethodName();
To access the right element from the array from the getStackTrace().