Don't append list of accounts every time we return to this screen.
Bug: 5355920
Remove the contents of the layout before adding the accounts.
Change-Id: Ic9256140f892968b2388f47d982eaada720df892
diff --git a/res/layout/master_clear.xml b/res/layout/master_clear.xml
index e15169e..268daa0 100644
--- a/res/layout/master_clear.xml
+++ b/res/layout/master_clear.xml
@@ -51,7 +51,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
- android:visibility="gone" />
+ android:visibility="gone">
+ <!-- Do not add any children here as they will be removed in the MasterClear.java
+ code. A list of accounts will be inserted programmatically. -->
+ </LinearLayout>
<TextView android:id="@+id/erase_external_option_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/src/com/android/settings/MasterClear.java b/src/com/android/settings/MasterClear.java
index 39b17a9..495f3fd 100644
--- a/src/com/android/settings/MasterClear.java
+++ b/src/com/android/settings/MasterClear.java
@@ -175,6 +175,7 @@
private void loadAccountList() {
View accountsLabel = mContentView.findViewById(R.id.accounts_label);
LinearLayout contents = (LinearLayout)mContentView.findViewById(R.id.accounts);
+ contents.removeAllViews();
Context context = getActivity();