title: How to change a view after user clicked on a button and a Firestore document got updated?
body: <p>So basically when a user comes to the "premium" activity in my app he sees a button which says "Purchase premium". When he clicks on it a document in Firestore gets updated (a boolean from false to true) and the button disappears and instead of the button a TextView appears. When the user navigates back to the MainActivity and from there again to the "premium" activity he sees the "Purchase premium" button again which I don't want because he already "bought" it. The question is how can I achieve that when the user clicks on the button, the view of the layout changes for good, so when the user navigates back to the activity he will not be able to make the purchase again. I don't want him to see the button.</p>
  
  <p>Should I use the boolean (premium member: true) that got changed in the document in Firestore after he clicked on it to do this? Like: If document says "premium membership: true" set button visibility gone etc. This would make a "read" to Firestore every time the user navigates to the Activity, is there a better way?</p>
  
  <p>Here is my onClickListener of the purchase button:</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_premium_purchase);
  
          purchase = findViewById(R.id.card_view_premium_purchase);
          premiumTextView = findViewById(R.id.premium_purchase_success);
  
          premiumTextView.setVisibility(View.GONE);
  
          purchase.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
  
                  String username = user.getDisplayName();
  
                  DocumentReference userRef = db.collection("User").document(username);
  
                  // Set the "pro membership" to true
                  userRef
                          .update("pro membership", true).addOnSuccessListener(new OnSuccessListener&lt;Void&gt;() {
                      @Override
                      public void onSuccess(Void aVoid) {
                          Log.d(TAG, "DocumentSnapshot successfully updated!");
                          Toast.makeText(PremiumPurchaseActivity.this, "Guess Premium successfully bought", Toast.LENGTH_SHORT).show();
                          premiumTextView.setVisibility(View.VISIBLE);
                          purchase.setVisibility(View.GONE);
                      }
                  })
                          .addOnFailureListener(new OnFailureListener() {
                              @Override
                              public void onFailure(@NonNull Exception e) {
                                  Log.w(TAG, "Error updating document", e);
                              }
                          });
              }
          });
      }
  
  </code></pre>