My app will start if I don't take away the title bar but when I do it crashes as soon as it starts.
This is the code I have so far.
?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.v1.solitare"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name">
<activity
android:name="com.v1.solitare.MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Please help in any way possible. I just picked up Android coding with Eclipse today and I'm very new at it.
Edit: I think I found the LogCat Errors for it:
04-02 22:06:28.986: E/AndroidRuntime(28352): FATAL EXCEPTION: main
04-02 22:06:28.986: E/AndroidRuntime(28352): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.v1.solitare/com.v1.solitare.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2359)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.access$700(ActivityThread.java:165)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1326)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.os.Looper.loop(Looper.java:137)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.main(ActivityThread.java:5455)
04-02 22:06:28.986: E/AndroidRuntime(28352): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 22:06:28.986: E/AndroidRuntime(28352): at java.lang.reflect.Method.invoke(Method.java:525)
04-02 22:06:28.986: E/AndroidRuntime(28352): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
04-02 22:06:28.986: E/AndroidRuntime(28352): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
04-02 22:06:28.986: E/AndroidRuntime(28352): at dalvik.system.NativeStart.main(Native Method)
04-02 22:06:28.986: E/AndroidRuntime(28352): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:111)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
04-02 22:06:28.986: E/AndroidRuntime(28352): at com.v1.solitare.MainActivity.onCreate(MainActivity.java:18)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.Activity.performCreate(Activity.java:5372)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)
04-02 22:06:28.986: E/AndroidRuntime(28352): ... 11 more
ActionBarActivity
assumes you are using an ActionBar
, while Theme.NoTitleBar
themes remove the ActionBar (as that is part of the title bar on newer devices and ActionBarActivity
assumes you are using a Theme.AppCompat
theme which controls styling for the ActionBar).
Change your activity to extend FragmentActivity
if you are okay with not having an Action Bar, although as per the Android design docs is a critical component for making your app feel like an Android app (although some would say that games are granted more leeway).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With