An Android Android tool that contains duplicates or similar pieces of code?

I have a code block of about 1200 lines of code in my Activity. Is there a tool that looks at my code and finds some kind of similar duplicate of code that can be placed in one way? Like this:

onCreate(){ image1.startAnimation(am1) ; image2.startAnimation(am1) ; ..... image1.startAnimation(am1) ; image2.startAnimation(am1) ; } 

I want to put the same code in one method, is there a way to automatically detect duplicate codes?

+6
source share
1 answer

IntelliJ is able to detect duplicate code by running static analysis , but this tool is not yet available in Android Studio. Hope this will be added sooner or later.

In the meantime, you can try PMD , although this is not very convenient for the Android source code.

+5
source

All Articles