2

Consider this example.

public class myclass {

public void...
public int ...

    private class my_nested_class {
          Intent i = new Intent(this, List.class);
    }

}

I would like "this" to be myclass. How can I do that? "this.super"? But that doesn't work.

Michael Petrotta
  • 58,479
  • 27
  • 141
  • 176
TIMEX
  • 238,746
  • 336
  • 750
  • 1,061
  • maybe you wanto to tag it also with android? –  Feb 15 '10 at 08:58
  • Every nested class has its own 'this'. What you mean is `how do I access the enclosing outer class instance' and its answered here: http://stackoverflow.com/questions/1816458/getting-hold-of-the-outer-class-object-from-the-inner-class-object – Jherico Feb 15 '10 at 09:10

1 Answers1

8

It's myclass.this.

By the way, class names start with a capital letter in Java, you should rename your class MyClass.

Jerome
  • 8,339
  • 2
  • 31
  • 41