This error occurs because you create an object and pass it to another class reference variable. Since getActionManager provides an android.app.ActionBar object, but you are trying to assign an android.app.ActionBar class object to android.support.v7.app.ActionBar .
But both of these classes provide the same functionality. android.support.v7.app.ActionBar The class is used when our version of -sdk min is less than api 11. to get the ActionBar object below api 11 we need an object of class android.support.v7.app.ActionBar .
To get the action bar, you need to follow one of two approaches.
import android.support.v7.app.ActionBar and use the od operation getSupportActionBar() .
go to the AndroidManifest.xml file and change <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19" /> and import android.app.ActionBar and use getActionBar()
source share