コード例 #1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_profile);
    controller = (Controller) getApplicationContext();
    User current_user = controller.getCurrentUser();

    Intent intent = getIntent();
    String user_id = intent.getStringExtra("user_id");

    if (!(current_user.getId().matches(user_id))) {
      View edit_button = findViewById(R.id.edit_profile_button);
      edit_button.setVisibility(View.GONE);
      user = current_user;
    } else {
      user = controller.getUserById(user_id);
    }

    setUsernameTextView();
    setEmailTextView();
  }
コード例 #2
0
 /** Initialize the email <code>TextView</code> */
 public void setEmailTextView() {
   TextView emailTextView = (TextView) findViewById(R.id.view_profile_email_tv);
   String email = user.getEmail();
   emailTextView.setText(String.format("Email: %s", email));
 }
コード例 #3
0
  /** Initialize the username <code>TextView</code> */
  public void setUsernameTextView() {
    TextView usernameTextView = (TextView) findViewById(R.id.view_profile_username_tv);
    String name = user.getName();

    usernameTextView.setText(String.format("Username: %s", name));
  }