Question: I have the following jQuery code:

```
$('#foo').click(function ()  {
    var loading = $('<img id="loading" src="images/loader.gif" alt="loading" />');
    $('#stars').prepend(loading);
    alert('WAIT');
});

$('#bar').click(function ()  {
     $('#stars').empty();
});

```

When first clicking `#foo` the image is being shown in my browser window. After clicking `#bar` and then `#foo` again the image is not being shown.

I use Chrome and also use the `Inspect Element` tool and I can see in the code that the `img` tag was added in `#stars` when clicking for the second time `#foo`. But no `img` is being shown in the browser window.

Any ideas why? Should I use the `live()` function perhaps, but how?

Answer: 
`onMeasure()` is usually called during layout phase. Besides as far as I know `onMeasure()` is where *YOU* have to measure your view. It receives 2 values which are the size of the parent of your view which may be constant.

Why don't you just check the length of the text you're setting and if it's too long just replace it with your default one?
From the [`View`](http://developer.android.com/reference/android/view/View.html#onMeasure%28int,%20int%29) documentation page.

> 
> Measure the view and its content to determine the measured width and
>  the measured height. This method is invoked by **measure(int, int)**
>  and should be overriden by subclasses to provide accurate and 
>  efficient measurement of their contents.
> 
> 
> 

If you want the textview to have limited width or height call `setMaxWidth()` `setMaxHeight()` `setMaxLines()` or check it manualy and change is the way you like from a custom method