dhsmith
dhsmith

Reputation: 250

Android app force closes when theme is set

I'm just getting started with Android dev, done a few tutorials, now I'm working on a simple app. On both the emulator and my phone (Android 4.0.3 emulator, Android 4.1.1 Atrix HD) apps are displaying in what I think is Holo Light. I'd rather have it be Holo Dark, but when I add the following line to the application block in the Android Manifest file: android:theme="@android:style/Theme.Holo" the app compiles fine but force closes as soon as I open it.

What am I doing wrong? I'm sure it's something really simple, but as I said I'm new to this. Thanks in advance, y'all!

Upvotes: 3

Views: 472

Answers (2)

Taras Leskiv
Taras Leskiv

Reputation: 1875

The simplest thing you can do and you should always do is to read logs why does it crash. The log will tell you the reason of you crash. Please post the reason including logs from Logcat and only then ask about fixes:)

Upvotes: 1

ridoy
ridoy

Reputation: 6342

If you want to use a theme for all the activities of your application then you need to use

<application android:theme="@style/CustomTheme">

in AndroidManifest.xml.If you want a theme applied to just one Activity in your application, then add the android:theme attribute to the activity tag instead.So need to know what type you use in your application.However see these things which will clear you more..
http://developer.android.com/guide/topics/ui/themes.html
http://www.androidengineer.com/2010/06/using-themes-in-android-applications.html

Upvotes: 1

Related Questions