Question

I'm having a weird problem, the progress bar on the action bar is not showing up for older android versions. I've been mainly testing with my phone (4.3) and an emulator (2.3.3) and my phone will display the progress bar, but the emulator wont.

I'm using the AppCompat library, and ActionBarActivity which utilizes a drawer layout. The code to get the progress bar is as follows:

requestWindowFeature(Window.FEATURE_PROGRESS);    
setContentView(R.layout.activity_main);
setProgressBarIndeterminate(true);

and then is toggled with the following inside of the fragment.

getActivity().setProgressBarVisibility(false);

I should also mention that the following is also enabled on the actionbar:

getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);

Any idea why this works on 4+ but not on 2.3.3?

Thanks!

Was it helpful?

Solution

Change your onCreate() to call support methods instead of standard ones, as:

supportRequestWindowFeature(Window.FEATURE_PROGRESS);
supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.activity_main);
setSupportProgressBarIndeterminate(true);

And also when you want to display the progress:

getActivity().setSupportProgressBarVisibility(false);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top