Tnx.

So after further investigation it seems this bug was introduced in API
11 and is somehow related to the ActionBar. The leak does not occur on
versions prior to that, so using either android:theme="@android:style/
Theme.NoTitleBar.Fullscreen" or
requestWindowFeature(Window.FEATURE_NO_TITLE) will not leak the
Activity prior to API 11.

If targeting HONEYCOMB and above, you can hide the ActionBar like this
*after* setContentView

        @TargetApi(11)
        private void hideActionBar() {

                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                        ActionBar actionBar = getActionBar();
                        // This check might be unnecessary, but it helped me 
find that
getActionBar() should be called after setContentView !!
                        if (actionBar != null) {
                                actionBar.hide();
                        }
                } else {
                        requestWindowFeature(Window.FEATURE_NO_TITLE);
                }
        }

The noticeable problem with this approach is that the ActionBar will
appear for a fraction of a moment, plus you will not have access to
the options menu in HONEYCOMB

What I decided to do, in the absence of a better solution, is simply
avoid all this:

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="8" />

Personally, I always prefer framework stability and correctness on top
of new api’s ...


On Sep 2, 11:27 am, tvdalia <truptida...@gmail.com> wrote:
>   You can give theme as Dialog and hide the window title bar.
>   Otherwise, to display an Activity, I believe you cnanot hide the title
> bar without using any of the below options.
>
>   Regards,
>
>
>
> On Saturday, 1 September 2012 22:12:19 UTC+5:30, itai wrote:
> > Filled bug below… Anyone know how to hide the title bar without using
> > either requestWindowFeature(Window.FEATURE_NO_TITLE) or  XML
> > Theme.NoTitleBar to avoid this ?
>
> >https://code.google.com/p/android/issues/detail?id=36950&colspec=ID%2...
>
> > tnx.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to