Theming issue with ABS 4.0 and Android 4.0.3 ?

420 views
Skip to first unread message

Carlos P

unread,
Mar 19, 2012, 5:14:59 PM3/19/12
to actionba...@googlegroups.com
Hullo

Forgive me if I'm missing something, but I don't believe I've changed anything since testing out Beta 5, yet am getting this error.

My application's theme has a parent of Theme.Sherlock.  It is defined in the manifest as so:

    <application
        android:icon="@drawable/main_icon"
        android:label="@string/app_name" 
        android:name="com.myapp.MyApplication"
        android:theme="@style/Theme.BCBase"
        >

Then, my theme extends from Theme.Sherlock, in file values/theme.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources >    
    <style name="Theme.BCBase" parent="Theme.Sherlock">
        <item name="android:windowNoTitle">true</item>
    </style>
</resources>


This runs with no problem on older versions of Android, e.g. 2.3.3, but on ICS I get a NullPointerException, since actionBar is returned as NULL from getSupportActionBar in this line:


    public void onCreate(Bundle savedInstanceState) {

   super.onCreate(savedInstanceState);


...

        // Configure action bar
        ActionBar actionBar = getSupportActionBar();  <===  returns NULL

      ...
}


Any ideas?


Carlos

Jake Wharton

unread,
Mar 19, 2012, 5:17:10 PM3/19/12
to actionba...@googlegroups.com
Because <item name="android:windowNoTitle">true</item> hides the action bar on ICS+. If you added <item name="windowNoTitle">true</item> it would be hidden on pre-ICS too.
Message has been deleted

Carlos P

unread,
Mar 19, 2012, 5:19:01 PM3/19/12
to actionba...@googlegroups.com
Sorry, I forgot to say, I'm using the very latest Sherlock Maps plugin (added as an external JAR to my app), so my activity extends from SherlockMapActivity, if that makes any difference. 

Carlos P

unread,
Mar 19, 2012, 5:23:41 PM3/19/12
to actionba...@googlegroups.com
Right - got it.  Thanks Jake, and cheers for such a speedy reply too!
Reply all
Reply to author
Forward
0 new messages