I am creating a testing / analysis tool that requires tools for the Android framework classes. In this tool, classes should be instructed to find out the calling method (that is, the method signature) that is currently executing, and some processing is done based on the calling party. My question is: what method should I use to determine the caller?
I know that one approach is to use java.lang.Throwable and the getStackTrace method. However, this is inefficient. Is there any other (open or hidden) API (similar to sun.reflect.Reflection.getCallerClass of the standard JDK) for the Android platform that can be used?
anand source share