ActionBar setProgressBarIndeterminateVisibility (false) does not work on android 2.3

The setProgressBarIndeterminateVisibility (false) function does not work for 2.3 android. I am using the code below. A progress bar is always displayed and not hidden. The same code works with android 4.x, and the progress bar is hidden. This activity is from SherlockFragmentActivity, and there is no call of type setSupportProgressBarIndeterminateVisibility (true); which will make the progress bar visible. My full code is:

@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 suggest a way so that I can hide the progress bar on android 2.x. Thanks

+6
source share
3 answers

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

If you call it from SherlockFragment or simply:

 setSupportProgressBarIndeterminateVisibility(false); 
+14
source

Try using this method to display:

 setSupportProgressBarIndeterminateVisibility(true); 

and hide this method:

 setSupportProgressBarIndeterminateVisibility(false); 

Both work for me on android 2.3.3 to 4.1.7

+1
source

Just call

 setSupportProgressBarIndeterminateVisibility(false); 

after setContentView

0
source

All Articles