@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_profile: Intent i = new Intent(this, UserProfileActivity.class); i.putExtra("playerID", player.getUserName()); startActivity(i); finish(); } return super.onOptionsItemSelected(item); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_join_quiz_room); ImageView profilePictureView = (ImageView) findViewById(R.id.profile_pic_imageview); profilePictureView.setImageBitmap(Utils.getProfilePicture()); View header = findViewById(R.id.headerLayout); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); String json = pref.getString("player", ""); JSONDeserializer<Player> des = new JSONDeserializer<Player>(); player = des.deserialize(json); TextView tvHeader = (TextView) header.findViewById(R.id.tvHeaderName); tvHeader.setText(player.getDetails().getName()); }