How to make a recursive onClickListener for expanding and collapsing?
<p>In plain english, I have a textview, and when I click on it I want it to expand, and when I click on it again, I want it to compress. How can I do this? I've tried the below, but it warns on the final line about expander might not be initialized on holderFinal.text.setOnClickListener(expander);</p>

<p>So now the code:</p>

<pre><code>
final View.OnClickListener expander = new View.OnClickListener() {
@Override
  public void onClick(View v) {
    holderFinal.text.setText(textData);
    holderFinal.text.setOnClickListener( new View.OnClickListener() {       
    @Override
      public void onClick(View v) {                                    
        holderFinal.text.setText(shortText);
        holderFinal.text.setOnClickListener(expander);
      }
    });
 }
};
</code></pre>
