ViewTreeObserver Listener not called after some time
<p>I have great difficulties when using ViewTreeObserver. All works fine for some unpredictable period of time, and then the listener is not operational anymore. It is certainly because of what is written in the doc:<strong>The returned ViewTreeObserver observer is not guaranteed to remain valid for the lifetime of this View</strong>
Therefore i redo the setup every time I change my view:</p>

<pre><code>   protected void shrinkToFit(final TextView t) {
    if(vto==null||!vto.isAlive()){
    vto = t.getViewTreeObserver();
    vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
        public void onGlobalLayout() {
            doAdjust(t);
        }
    });
    }
}
</code></pre>

<p>and here's how I invoke it:</p>

<pre><code>TextView t = (TextView) findViewById(R.id.maindesc);

                t.setTextSize(Constants.MAINDESC_SIZE);

                String todisp_1 = tarifreadtemp.area_desc + ":"
                        + tarifreadtemp.area_tarifuserdesc;
                shrinkToFit(t);
                t.setText(todisp_1);
                t.invalidate();
</code></pre>
