instead of getActionBar()
use getSupportActionBar()
EDIT:
You are getting errors, because your imports are wrong. Please use the same as below. This works just fine.
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.text.Html;
public class TestActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionBar = getSupportActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#95CDBA")));
actionBar.setTitle(Html.fromHtml("<font color='#000099'>Hello World</font>"));
}
}
Yes, this is Google's mistake, it should have a different name. SupportActionBar would be great.
If you are unable to fix the imports, you can explicitly specify which one like this
android.support.v7.app.ActionBar actionBar = getSupportActionBar();