I setup ActionBarSherlock with my app, and I'm trying to use the Intermediate Progress, I'm using this:
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setSupportProgressBarIndeterminateVisibility(false);
In my onCreate, and then using:
setSupportProgressBarIndeterminateVisibility(true);
To enable it.
It works fine in ICS but it doesn't work at all in Gingerbread or Froyo, does anyone know how to get it to work? Thanks
Check, if you are using
Theme.Sherlock.NoActionBar
or similar no action bar theme for this activity. In this casesetSupportProgressBarIndeterminateVisibility
method fails for me withI guess you should use a progress dialog instead to indicate loading process or regular
Theme
with activity title bar and then usesetProgressBarIndeterminateVisibility
method for older platforms.I'm sure you've probably figured it out by now, but the most likely culprit is you including the wrong file because it's so easy to do automatically.
Replace any import of android.view.Window with com.actionbarsherlock.view.Window and the needed features will work.
I just had the same problem. Jake's solution above did not fix it for me - the method is undefined.
I found a working solution posted by Jake on the bug list for ActionBarSherlock here:
See Jake's response to the poster - the trick is to call
getSupportActionBar()
first, to "trigger creation of the views".So my
onCreate()
method is:Update based on comment from Laux:
Make sure your imports reflect
com.actionbarsherlock.view.Window.FEATURE_INDETERMINATE_PROGRESS
for this to work.Here is part of my
import
block from an app that uses this pattern:This is a very good thing to remember when working with ABS - many of your normal Android imports should be updated to refer to ABS instead.
It may be a good idea to revisit your import block, or possibly remove it entirely and let Eclipse rebuild it for you (CTRL-SHIFT-O) to which point Eclipse will prompt you for each import that ABS redeclares.
This was also explained by Glebbb in his answer.
You need to call
supportRequestWindowFeature
.requestWindowFeature
is a final method onActivity
and couldn't be overriden.