0

For projects reasons I need to find out which methods of a class are referenced (used) and how many times. Lint gives me ability to find which are unused but I cannot find any tool to precise how many times methods are referenced. It could be an Android Studio plugin or a library (or any other way that prepares these statistics)

thanks in advance for your support

hhg
  • 649
  • 1
  • 11
  • 20

1 Answers1

0

You have to first step back and and clarify your requirements.

To determine how often a method is used within other pieces of code is trivial; any decent IDE allows you search your project/workspace for usage of methods.

But you are asking about count statistics. That is a **completely* different thing. An easy solution is to simply put static counters into your classes manually. But such self-grown solutions can turn pretty complex quickly; as people start asking for all kinds of solutions. Thus you might rather looking into profiling tools, such as those for java in general, or specifically for Android: look here.

Community
  • 1
  • 1
GhostCat
  • 137,827
  • 25
  • 176
  • 248
  • You're right, so to precise my question: I need a tool for an Android project that will determine how often a method is used with the projects code (with a narrowed package filter). It must be something programmatic rather than a key combination that searches method usages. My aim is to apply it on a large set of methods and have an output: Class A -> method B: used 20 times Class C -> method D: used 4 times etc.. I've found a library that does that (and more) but it can't be used on Android http://stackoverflow.com/questions/32772229/reflections-library-returns-empty-list-in-android – hhg Apr 01 '17 at 22:13