Android onFocusChanged function never called
<p>I have created a custom button in extending <code>View</code> class as specified in this tutorial:</p>

<blockquote>
  <p><a href="http://kahdev.wordpress.com/2008/09/13/making-a-custom-android-button-using-a-custom-view/" rel="nofollow">http://kahdev.wordpress.com/2008/09/13/making-a-custom-android-button-using-a-custom-view/</a></p>
</blockquote>

<p>But I have a problem with the function <code>onFocusChanged()</code> which is never called. </p>

<p>This is my code:</p>

<pre><code>public class CustomButton extends View
{
    ...
    public CustomButton(Context context, Car car) 
    {
        super(context);
        setFocusable(true);
        setBackgroundColor(Color.BLACK);
        setOnClickListener(listenerAdapter);
        setClickable(true);
    }

    @Override
    protected void onFocusChanged(boolean gainFocus, int direction,
                                  Rect previouslyFocusedRect)
    {
        if (gainFocus == true)
        {
            this.setBackgroundColor(Color.rgb(255, 165, 0));
        }
        else
        {
            this.setBackgroundColor(Color.BLACK);
        }
    }
    ...
}
</code></pre>

<p>In fact, when I click on my custom button nothing happens... With the debugger, I can see that the function is never called. And I don't know why.</p>

<p>So, had I forgotten a step ? Is there another thing I have missed ?</p>
