I am following udacity to course to learn android developement. when I run the app on emulator, action bar
is not shown.
I have another activity which is triggered by the main activity. If I do not add following line in android_manifest
file then when clicking on listview in main activity gives me following error
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
So I googled this error and I got that App-Compat
should be used.
So I added this following line in android_manifest
file
<application
....
....
android:theme="@style/Theme.AppCompat"
>.....</application>
So after adding this line I get following screen which has no action bar.
When I remove the line in android:theme="@style/Theme.AppCompat
manifest
file, I get Action bar but after clicking the list view gives me that error
EDIT
This is my styles.xml file
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
EDIT
My manifest file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.suraj.sunshine">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".DetailedActivity"
android:label="@string/title_activity_detailed"
android:parentActivityName=".MainActivity"
>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.suraj.sunshine.MainActivity" />
</activity>
<activity
android:name=".SettingsActivity"
android:label="@string/title_activity_detailed"
android:parentActivityName=".MainActivity"
>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.suraj.sunshine.MainActivity" />
</activity>
</application>
</manifest>