Afaik, in Java an anonymous inner class always holds a reference to the enclosing instance of its outer class. Now what happens when I put an anonymous class inside a static method? As there is no object of its outer class, does it hold a reference to the class that calls the static method? I am a bit confused here. Consider the Android example below (using the parse.com framework):

```
public class OnlineQuery {    
    public static void queryUsers(final ListenerInterface listener) {
        ParseQuery<ParseUser> query = User.getQuery();
        query.findInBackground(new FindCallback<ParseUser>() {
            @Override
            public void done(final List<ParseUser> userList, ParseException e) {
            listener.reportBackToCallingActivity();    
            // to which class is as a reference held here?
            }
        });
    }
}

public class MainActivity extends Activity implements OnlineQuery.ListenerInterface {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        OnlineQuery.queryUsers(this)
    }
    ...
}

```

Also, is using a listener as shown in the example bad practice regarding memory leaks?
Thanks!