Question: I am making an android app. I need to add a button to the title bar of an activity. I cannot put it in the action bar because of backward compatibility problems. I searched a lot but couldn't find a satisfactory solution for this. Thanks.

Answer: 
> 
> Action bar requires API level 11 to work, my app's minimum is 9
> 
> 
> 

Use a backport, like [ActionBarSherlock](http://actionbarsherlock.com/), which offers action bars back to API Level 7. More importantly, it does so using an API compatible with the official action bar implementation, and so dropping ActionBarSherlock in a year or two (when you drop support for API Level 9-10) will be fairly easy. And, your app will have a consistent look and feel with other Android apps.
I needed something similar and created a custom title bar as follows:

* Create a custom View class (I extended linearlayout)
* Add this view to the layout xml of your activity, in the top
* Hide the default bar, using `requestWindowFeature(Window.FEATURE_NO_TITLE);` (if I remember correctly, it is crucial to do this *before* setting the content view of your activity).