Can't run Swip tab application because getActionBar returning null in Android 5

77 Views Asked by At

I want to create swipe tabs in Android app (Android L) many classes are depricated and getActionBar() returns null. I tried to run few examples available in google but same problem everywhere

1

There are 1 best solutions below

0
On

For those who get NullPointerException changing style to Base.ThemeOverlay.AppCompat.ActionBar surely works.

<style name="AppTheme" parent="Base.ThemeOverlay.AppCompat.ActionBar">
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
</manifest>