Hm, the background bitmap is shown basically based on whether
View.isHardwareAccelerated() returns true.  The only time they can be
different is when the view hierarchy is running in a process which has
turned off hardware acceleration, which basically only happens as a special
case in the system process so not something your application code will ever
see.

BouncingBalls is not a good example, because that one actually turns off
hardware acceleration (look at the activity declaration in the manifest).

Oh and you need to make sure you don't call this until *after* a view is
attached to its window.  That is, after View.onAttachedToWindow().  Prior to
that it doesn't have a surface any context for what it will be running in,
so it can't return anything useful.  In other words if you are just calling
this from Activity.onCreate(), that is too soon to actually get a good
value.

On Tue, Apr 5, 2011 at 1:31 AM, Shai <levys...@gmail.com> wrote:

> Same results with ApiDemos!
>
> I created a new sample project (ApiDemos) using ADT with API level 11
> as the target and I tried the following:
> I DO get the patterned blue background in the main screen (seems like
> hardware acceleration is working).
>
> In ApiDemos.Java:
> - In the "OnCreate" I added a log print for
> "getListView().isHardwareAccelerated()" and was "False"
>
> - In BouncingBalls.Java near the end of the onCreate I added a log
> print :
>
>        MyAnimationView v =new MyAnimationView(this);
>        container.addView(v);
>        Log.e("Test", "Result:" + v.isHardwareAccelerated());
>
> It was also false
>
> - In BouncingBalls.Java at MyAnimationView.onDraw(Canvas canvas)
> Log.e("Test", "Canvas is:" + canvas.isHardwareAccelerated());
>
> It was also false
>
>
> Can someone clear this out for me ?
> Is hardware acceleration off ?
> Is this a bug in the isHardwareAccelerated() function or am I doing
> something wrong ?
>
> Best Regards,
> Shai Levy
>
> On Apr 4, 9:58 pm, Dianne Hackborn <hack...@android.com> wrote:
> > API demos is hardware accelerated.  Try putting the call in one of the
> > simple samples there and see what it does.
> >
> > Fwiw, if you are using the default dark theme, if your window is hardware
> > accelerated than you will get the patterned blue background.  If it is
> > drawing in software you will get the solid black background.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Mon, Apr 4, 2011 at 10:53 AM, Shai <levys...@gmail.com> wrote:
> > > Hi,
> >
> > > I am trying to turn on hardware acceleration for my HoneyComb
> application
> > > but I never seem to get a 'true' result from this function.
> >
> > > I tried all the methods in the Android Developers blog post about the
> > > subject (
> > >http://android-developers.blogspot.com/2011/03/android-30-hardware-ac.
> ..
> > > ).
> >
> > > I am working on a completely blank project (ADT generated project), I
> added
> > > the  tag  android:hardwareAccelerated="true"  to both the application
> and
> > > activity and even called
> > >         getWindow().setFlags(
> > >                 WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
> > >                 WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
> >
> > > before calling setContentView()
> >
> > > My view only has the TextView that was automatically generated from the
> ADT
> > > new project wizard.
> >
> > > Yet, no matter what I do, when I call isHardwareAccelerated() on the
> > > textview or the root view or any canvas I try to obtain - the function
> > > isHardwareAccelerated() of the view/canvas always returns false.
> >
> > > I am testing on a Motorola Xoom device with Android 3.0.1
> >
> > > What am I missing here ?
> >
> > > Best Regards,
> > > Shai
> >
> > >  --
> > > 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
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > hack...@android.com
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see
> and
> > answer them.
>
> --
> 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
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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