protected void initView(View view) { mActivity.setTopBar("朋友圈设置", CreateFriendCircleActivity.SET_FC); civZzHeadImg = (CustomImageView) view.findViewById(R.id.civ_add_zz_tx); civZzHeadImg.setOnClickListener(this); ivZzBgImg = (ImageView) view.findViewById(R.id.iv_add_zz_bg); ivZzBgImg.setOnClickListener(this); etZzName = (EditText) view.findViewById(R.id.et_zz_name); }
@Override public void onResume() { super.onResume(); FriendCircleBean fc = mActivity.getNewFcBean(); if (fc != null) { ivZzBgImg.setImageBitmap(fc.getBgIcon()); civZzHeadImg.setPic(fc.getHeadIcon()); etZzName.setText(fc.getName()); } }
protected void initView(View view) { initTopView(view); RelativeLayout rl_me_home = (RelativeLayout) view.findViewById(R.id.rl_me_home); rl_me_home.setOnClickListener(this); RelativeLayout rl_me_head = (RelativeLayout) view.findViewById(R.id.rl_me_head); rl_me_head.setOnClickListener(this); RelativeLayout rl_me_nickname = (RelativeLayout) view.findViewById(R.id.rl_me_nickname); rl_me_nickname.setOnClickListener(this); RelativeLayout rl_me_sex = (RelativeLayout) view.findViewById(R.id.rl_me_sex); rl_me_sex.setOnClickListener(this); RelativeLayout rl_me_area = (RelativeLayout) view.findViewById(R.id.rl_me_area); rl_me_area.setOnClickListener(this); RelativeLayout rl_me_introduction = (RelativeLayout) view.findViewById(R.id.rl_me_introduction); rl_me_introduction.setOnClickListener(this); if (contactBundle != null) { ContactsBean contact = contactBundle.getParcelable("contact"); if (contact != null) { CustomImageView headImg = (CustomImageView) view.findViewById(R.id.civ_contact_head); headImg.setPic(contact.getImage()); TextView name = (TextView) view.findViewById(R.id.tv_nickname_value); name.setText(contact.getName()); } } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { Log.i("cyy-cyy", "requestCode=" + requestCode); if (data == null) { // TODO 如果之前以后有设置过显示之前设置的图片 否则显示默认的图片 return; } Bundle extras = data.getExtras(); if (extras != null) { Bitmap photo = extras.getParcelable("data"); ByteArrayOutputStream stream = new ByteArrayOutputStream(); // photo.compress(Bitmap.CompressFormat.PNG, 100, stream);// (0-100)压缩文件 // 此处可以把Bitmap保存到sd卡中,具体请看:http://www.cnblogs.com/linjiqin/archive/2011/12/28/2304940.html if (requestCode == FOR_HEAD_IMG) { mActivity.getNewFcBean().setHeadIcon(photo); // zuzu对象设置bitmap的话,由于过大不能用intent传参 civZzHeadImg.setPic(photo); // 把图片显示在ImageView控件上 } else if (requestCode == FOR_BG_IMG) { mActivity.getNewFcBean().setBgIcon(photo); ivZzBgImg.setImageBitmap(photo); } } }