9

I am using Eclipse MAT to try and track down a resource leak in Android (if you change screen orientation a lot) and when I go to the histogram view, I see my activity listed along with the same activity listed again and again with a $ after it.

So like:

com.test.TestActivity
com.test.TestActivity$1
com.test.TestActivity$2
com.test.TestActivity$3

Just wondering what the $1, $2 and $3 means...

tia.

user645402
  • 737
  • 1
  • 16
  • 34
  • 1
    possible duplicate of [Java inner class .class file names](http://stackoverflow.com/questions/380406/java-inner-class-class-file-names) – Matt Ball Feb 01 '12 at 21:55

1 Answers1

18

They are anonymous inner classes.

For example:

Button button = (Button) findViewById(R.id.Button);  
button.setOnClickListener(new View.OnClickListener() {  
    public void onClick(View v) {  
        // ...
    }  
});

In this example the anonymous inner class is the subclass of View.OnClickListener.

Matt Ball
  • 354,903
  • 100
  • 647
  • 710