Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionBar setProgressBarIndeterminateVisibility(false) is not working on android 2.3

The setProgressBarIndeterminateVisibility(false) is not working for 2.3 android. I'm using the code below.The progress bar is show always and is not hidden. The same code is working on android 4.x and the progress bar is hidden. The activity is extending from SherlockFragmentActivity, and there is no call like setSupportProgressBarIndeterminateVisibility(true); that will make the progress bar visible. My complete code:

@Override
protected void onCreate(Bundle savedInstanceState) {
    ((SherlockFragmentActivity) JbActivity.this)
            .requestWindowFeature((long) com.actionbarsherlock.view.Window.FEATURE_INDETERMINATE_PROGRESS);
    super.onCreate(savedInstanceState);

    setSupportProgressBarIndeterminateVisibility(false);
    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    restart = false;
    actionBar = getSupportActionBar();
    if (SelectedItems.isNull()) {
        restart = true;
        try {
            String jsonString = savedInstanceState
                    .getString("SelectedItems");
            SelectedItems.build(jsonString);
        } catch (Exception e) {
            Intent mainIntent = new Intent(JbActivity.this,CityList.class);
            mainIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(mainIntent);
            finish();
        }
    }

}

There is no place in the code where I call Can you please suggest a way so I can hide the progress bar on android 2.x. Thanks

like image 392
user1796624 Avatar asked Apr 02 '13 13:04

user1796624


1 Answers

Try using : getSherlockActivity().setSupportProgressBarIndeterminateVisibility(false);

If you are calling it from a SherlockFragment or just :

setSupportProgressBarIndeterminateVisibility(false);
like image 71
hardartcore Avatar answered Sep 18 '22 01:09

hardartcore