From 683302f40e5b4bc972940faa79bb26382679d689 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 24 Jul 2014 21:46:23 -0700 Subject: [PATCH] remove views before adding new one. This shouldn't be possible, but google's received reports of it happening. --- .../android/XWords4/src/org/eehouse/android/xw4/Toolbar.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java index 5209b8493..a13f92704 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java @@ -160,7 +160,9 @@ public class Toolbar { int id = isLandscape ? R.id.tbar_parent_vert : R.id.tbar_parent_hor; ViewGroup scroller = (ViewGroup)m_activity.findViewById( id ); - scroller.addView( m_layout ); + // Google's had reports of a crash adding second view + scroller.removeAllViews(); + scroller.addView( m_layout ); // failing } m_layout.setVisibility( m_visible? View.VISIBLE : View.GONE );