Possible Duplicate:
Keyword for the outer class from an anonymous inner class?
My class (let's call it MyClass
) has m_listener
member that is used for notification purposes. There's no problem to use it from within an anonymous method:
private void myMethod(SomeObj myObj)
{
...
myObj.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
m_listener.myOnClick(this);
return false;
}
});
...
}
In the code this
refers to the anonymous OnTouchListener
instance. What should I write instead of this
to refer to MyClass
instance (just like m_listener
refers to MyClass.m_listener
, not to the OnTouchListener.m_listener
)?