How to access my object inside onClick(View v) function?
<p>I have defined a model class:</p>

<pre><code>public class MyObject {
    ...
}
</code></pre>

<p>In my activity, I get this object from SERVICE layer. Everything works fine at this point, my only question is, in Activity, if I set <strong><em>setOnClickListener</em></strong> to a <strong><em>TextView</em></strong>, how can I access <strong>myObject</strong>? What I mean is showing in the following code:</p>

<pre><code>//my custom object
MyObject obj = SERVICE.getObject();

TextView tx = new TextView(this);
tx.setText("Click me");
tx.setOnClickListener(
     new OnClickListener(){

             @Override
             public void onClick(View v){

                //how to access obj here? 
             }
      }
);
</code></pre>

<p>In the above code, I <strong>can not</strong> access <code>obj</code> inside <code>onClick(View v)</code> function, how to get rid of it to access <code>obj</code> inside <code>onClick(View v)</code> ?</p>
