Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionBarSherlock indeterminate progress indicator won't disappear in simulator

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?

like image 555
Rens Verhage Avatar asked Dec 16 '22 15:12

Rens Verhage


1 Answers

Use the proper ActionBarSherlock method to show and hide the progress.

setSupportProgressBarIndeterminateVisibility(visible);

instead of

setProgressBarIndeterminateVisibility(visible);
like image 75
Matthias Robbers Avatar answered Dec 27 '22 11:12

Matthias Robbers