My app is using Actionbar to set title and show subtitle which keeps changing according to user interaction, i am also using splitActionBarWhenNarrow and showing menu options in actionbar.
I want my app to support devices with older version of android (bellow API 11), for this i have to set  android:minSdkVersion="8", but when i set minimum sdk version bellow 11 i get error (Call requires API level 11 (current min is 8): android.app.Activity#getActionBar) on actionbar:
getActionBar().setTitle(record_name);
getActionBar().setSubtitle("Total: "+BigDecimal.valueOf(total).toPlainString()+"/-");
I tried to resolve this by adding an if condition to check version of API:
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if(currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB)
{   
    //Use Actionbar to set title and subtitle etc.
    getActionBar().setTitle(record_name);
    getActionBar().setSubtitle("Total: "+BigDecimal.valueOf(total).toPlainString()+"/-");
    getActionBar().setIcon(R.drawable.ic_header);
    getActionBar().setDisplayHomeAsUpEnabled(true);
}
else
{
}
But it dosent work, i still get error on getActionBar()...
What can i do to resolve this problem and avoid using actionbar if API is <11, and use actionbar if API is >=11 ?
 
     
     
     
    