I want my app to be compatible with Android 2.1. On my phone (HTC One X, Android 4+) everything is ok, but in the simulator (2.1), the indeterminate progress bar won't disappear.
I request the feature on creating my activity and start a loading task:
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstance);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
new LoadDataTask().execute();
}
In pre- and postExecute of my loading task, the progress bar is shown / hidden:
private class LoadDataTask extends AsyncTask<Void, Void, Void>
{
@Override
protected void onPreExecute()
{
setProgressBarIndeterminateVisibility(true);
}
@Override
protected void onPostExecute(Void result)
{
setProgressBarIndeterminateVisibility(false);
}
}
This works fine on my phone, but the simulator will only show the progress bar, never hide it.
Am I using a wrong approach here?
Use the proper ActionBarSherlock method to show and hide the progress.
setSupportProgressBarIndeterminateVisibility(visible);
instead of
setProgressBarIndeterminateVisibility(visible);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With