You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.
Invalid ActionBar look after adjusting of indeterminate progress visibility and calling invalidateOptionsMenu and updating list model in onPostExecute
#887
Open
httpdispatch opened this issue
Apr 3, 2013
· 3 comments
I've noticed this issue a long time ago but only now i was able to prepare demo which demonstrates it.
In application i have AsyncTask which may adjust visibility of actionbar indeterminate progress and reinit menu by calling invalidateOptionsMenu . This should hide refresh icon. This is working ok until i modify listView data model and call notifyDataSetChanged on adapter. After such action Actionbar may have broken view.
Expected view:
Broken view (Last item disappears or blank space added insted of in some cases):
The causing code is in onPostExecute
@OverrideprotectedvoidonPostExecute(Voidresult)
{
super.onPostExecute(result);
for (inti = 0; i < 10; i++)
{
adapter.items.add(i);
}
adapter.notifyDataSetChanged();
activity.stopLoading();
}
...
voidstopLoading()
{
if (loaders.decrementAndGet() == 0)
{
setSupportProgressBarIndeterminateVisibility(false);
invalidateOptionsMenu();
}
}
Any idea why is this happening and in most cases because of updating listview adapter? If i remove line adapter.notifyDataSetChanged(); actionbar will not be broken.
Project demonstrating an issue: http://goo.gl/ZbMTU (Updated, previous url was wrong)
The text was updated successfully, but these errors were encountered:
The demo may repeat the issue on android 2.1 emulator also. Original shots was from my ICS 4.0.3 device. The last menu item should not disappear and be unavailable even via menu button.
Keep digging on this issue. Seems that not exactly adapter.notifyDataSetChanged() causes invalid look, but the requestLayout call by the AdapterView.AdapterDataSetObserver which is listening for the data set changed event in the ListView. @JakeWharton any ideas?
I've noticed this issue a long time ago but only now i was able to prepare demo which demonstrates it.
In application i have AsyncTask which may adjust visibility of actionbar indeterminate progress and reinit menu by calling invalidateOptionsMenu . This should hide refresh icon. This is working ok until i modify listView data model and call notifyDataSetChanged on adapter. After such action Actionbar may have broken view.
Expected view:
Broken view (Last item disappears or blank space added insted of in some cases):
The causing code is in onPostExecute
Any idea why is this happening and in most cases because of updating listview adapter? If i remove line adapter.notifyDataSetChanged(); actionbar will not be broken.
Project demonstrating an issue: http://goo.gl/ZbMTU (Updated, previous url was wrong)
The text was updated successfully, but these errors were encountered: