Answer the question
In order to leave comments, you need to log in
Broken view of ActionBar after calling invalidateOptionsMenu, setSupportProgressBarVisibility and notifyDataSetChanged?
Noticed some unpleasant behavior in ActionbBar (ActionBarSherlock in particular). In the application, I use FEATURE_INDETERMINATE_PROGRESS which is shown when performing some actions. Also, when progress is shown, the action refresh should be hidden. To hide it, I have to call invalidateOptionsMenu, which, in turn, calls onPrepareOptionsMenu where I can already change the visibility
Override
public void onPrepareOptionsMenu(Menu menu)
{
reinitMenu(menu);
super.onPrepareOptionsMenu(menu);
}
protected void reinitMenu(Menu menu)
{
menu.findItem(R.id.menu_refresh).setVisible(
!getFActivity().isLoading());
}
Override
protected void onPostExecute(Void result)
{
super.onPostExecute(result);
for (int i = 0; i < 10; i++)
{
adapter.items.add(i);
}
adapter.notifyDataSetChanged();
activity.stopLoading();
}
…
void stopLoading()
{
if (loaders.decrementAndGet() == 0)
{
setSupportProgressBarIndeterminateVisibility(false);
invalidateOptionsMenu();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question