Skip to content

Commit b9503be

Browse files
committed
Only change visibility after all other UI tasks are performed
Post a runnable to set visibility of the content view to prevent race conditions.
1 parent c4eb163 commit b9503be

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

library/src/com/meetme/android/multistateview/MultiStateView.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ public void setState(final State state) {
9494

9595
switch (getState()) {
9696
case LOADING:
97-
contentView.setVisibility(View.GONE);
97+
contentView.post(new Runnable() {
98+
@Override
99+
public void run() {
100+
// Only change visibility after other UI tasks have been performed
101+
contentView.setVisibility(View.GONE);
102+
}
103+
});
98104
getLoadingView().setVisibility(View.VISIBLE);
99105
break;
100106

0 commit comments

Comments
 (0)