コード例 #1
0
  @Override
  public void onClick(View v) {
    // TODO Auto-generated method stub
    switch (v.getId()) {
      case R.id.bt_chat: // 聊天按钮
        // 加好友
        String toChatName = null;
        // Log.i("userInfo.getAccount()",userInfo.getAccount());
        // Log.i("MyApplication.getInstance().getUserName()",MyApplication.getInstance().getUserName());
        if (!TextUtils.isEmpty(userInfo.getAccount())) {
          toChatName = userInfo.getAccount();
          addContentToChat(toChatName);
        } else {
          startActivity(new Intent(this, AlertDialog.class).putExtra("msg", "出现了该用户用户名的罕见错误"));
          return;
        }

        break;
      default:
        break;
    }
  }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_friend);
    initView();
    initListener();

    // 获取数据
    intent = getIntent();
    userInfo = (UserInfo) intent.getSerializableExtra("user");
    tv_name.setText(userInfo.getUser_name());
    tv_account.setText(userInfo.getAccount());
    tv_sex.setText(userInfo.getSex());
    tv_address.setText(userInfo.getUser_position());
    tv_birthday.setText(userInfo.getBirthday().toString());
    tv_sign.setText(userInfo.getSignature());
    picPath = userInfo.getPhoto(); // 获取图片路径
    downPic(user_photo, picPath);
  }