Here is my code:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){ //android.support.v7.app.ActionBar actionBar = getSupportActionBar(); //actionBar.setTitle("Android"); ActionBar actionBar = getActionBar(); actionBar.setTitle("Droid"); }
While using the getSupportActionBar() my app runs just fine with kitkat and other new versions but using getActionBar results into an error.
Here is error:
Why? From android documentations :
Caution: Be certain you import the ActionBar class (and related APIs) from the appropriate package:
If supporting API levels lower than 11: import android.support.v7.app.ActionBar
If supporting only API level 11 and higher: import android.app.ActionBar
Now why this app is crashing?