From ac93a8031f408559a0273aa79d226fb001f876a4 Mon Sep 17 00:00:00 2001 From: hettysymes Date: Mon, 19 Jun 2023 15:24:00 +0100 Subject: [PATCH] fixed bug where interests duplicated --- app/src/main/java/com/example/drp25/MatchActivity.kt | 1 + app/src/main/java/com/example/drp25/UserProfileActivity.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/app/src/main/java/com/example/drp25/MatchActivity.kt b/app/src/main/java/com/example/drp25/MatchActivity.kt index c3f8b8e..4f349fa 100644 --- a/app/src/main/java/com/example/drp25/MatchActivity.kt +++ b/app/src/main/java/com/example/drp25/MatchActivity.kt @@ -70,6 +70,7 @@ class MatchActivity : AppCompatActivity() { val sharedInterests = mutableListOf() /* Generates TextViews for each interest. */ + interestsTable.removeAllViews() for (interest in snapshot.child("interests").children) { if (interest.key?.let { usSnapshot.hasChild(it) } == true) { // This interest is shared diff --git a/app/src/main/java/com/example/drp25/UserProfileActivity.kt b/app/src/main/java/com/example/drp25/UserProfileActivity.kt index f5fb5aa..a10a5c2 100644 --- a/app/src/main/java/com/example/drp25/UserProfileActivity.kt +++ b/app/src/main/java/com/example/drp25/UserProfileActivity.kt @@ -82,6 +82,7 @@ class UserProfileActivity : AppCompatActivity() { } }) + binding.interestsTable.removeAllViews() for (interest in snapshot.child("interests").children) { val inflater = LayoutInflater.from(this@UserProfileActivity) val rowView = inflater.inflate(R.layout.profile_interest, binding.interestsTable, false) as TableRow