@Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (resultCode == RESULT_OK) {
     switch (requestCode) {
       case REQUEST_TO_PLACE_PICKER:
         List<String> list =
             data == null
                 ? null
                 : data.getStringArrayListExtra(PlacePickerWindow.RESULT_PLACE_LIST);
         if (list == null || list.size() < 2) {
           CommonUtil.showShortToast(context, "请先选择地址哦~");
           CommonUtil.toActivity(
               context,
               PlacePickerWindow.createIntent(context, packageName, 2),
               REQUEST_TO_PLACE_PICKER,
               false);
           return;
         }
         String place = "";
         for (String s : list) {
           place += s;
         }
         tvEditTextInfoPlace.setText(place);
         break;
       default:
         break;
     }
   }
 }
  @Override
  public void initData() { // 必须调用
    super.initData();

    intent = getIntent();
    packageName = intent.getStringExtra(INTENT_PACKAGE_NAME);

    intentType = intent.getIntExtra(INTENT_TYPE, 0);
    if (StringUtil.isNotEmpty(intent.getStringExtra(INTENT_KEY), true)) {
      tvEditTextInfoTitle.setText(StringUtil.getCurrentString());
    }
    etEditTextInfo.setSingleLine(intentType != TYPE_NOTE);

    switch (intentType) {
      case TYPE_NICK:
        MaxLen = 20;
        break;
      case TYPE_PHONE:
        etEditTextInfo.setInputType(InputType.TYPE_CLASS_PHONE);
        MaxLen = 11;
        break;
      case TYPE_EMAIL:
        etEditTextInfo.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
        MaxLen = 60;
        break;
      case TYPE_WEBSITE:
        etEditTextInfo.setInputType(InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT);
        MaxLen = 60;
        break;
      case TYPE_MAILADDRESS:
        MaxLen = 60;
        break;
      case TYPE_PROFESSION:
        tvEditTextInfoRemind.setText("所属行业");
        MaxLen = 15;
      case TYPE_NOTE:
        MaxLen = 100;
        break;
      default:
        MaxLen = 30;
        break;
    }
    etEditTextInfo.setMaxEms(MaxLen);
    tvEditTextInfoRemind.setText("限" + MaxLen / 2 + "个字(或" + MaxLen + "个字符)");

    if (intentType == TYPE_MAILADDRESS || intentType == TYPE_USUALADDRESS) {
      tvEditTextInfoPlace.setVisibility(View.VISIBLE);
      CommonUtil.toActivity(
          context,
          PlacePickerWindow.createIntent(context, packageName, 2),
          REQUEST_TO_PLACE_PICKER,
          false);
    }
  }
  @Override
  public void initView() { // 必须调用
    super.initView();

    tvEditTextInfoTitle = (TextView) findViewById(R.id.tvEditTextInfoTitle);

    tvEditTextInfoPlace = (TextView) findViewById(R.id.tvEditTextInfoPlace);
    tvEditTextInfoPlace.setVisibility(View.GONE);

    etEditTextInfo = (EditText) findViewById(R.id.etEditTextInfo);
    ivEditTextInfoClear = findViewById(R.id.ivEditTextInfoClear);
    tvEditTextInfoRemind = (TextView) findViewById(R.id.tvEditTextInfoRemind);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.edit_text_info_window);
    // 类相关初始化,建议使用<<<<<<<<<
    context = this;
    isAlive = true;
    // 类相关初始化,建议使用>>>>>>>>>

    // 必须调用<<<<<<<<<<<
    initView();
    initData();
    initListener();
    // 必须调用>>>>>>>>>>

  }
  @Override
  public void initListener() { // 必须调用
    super.initListener();

    findViewById(R.id.tvEditTextInfoReturn).setOnClickListener(this);
    findViewById(R.id.tvEditTextInfoForward).setOnClickListener(this);
    tvEditTextInfoPlace.setOnClickListener(this);

    etEditTextInfo.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
            inputedString = StringUtil.getTrimedString(s);
            if (StringUtil.isNotEmpty(inputedString, true) == false) {
              ivEditTextInfoClear.setVisibility(View.GONE);
            } else {
              ivEditTextInfoClear.setVisibility(View.VISIBLE);
            }
          }

          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void afterTextChanged(Editable s) {}
        });
    ivEditTextInfoClear.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            etEditTextInfo.setText("");
          }
        });

    etEditTextInfo.setText(StringUtil.getTrimedString(getIntent().getStringExtra(INTENT_VALUE)));
    etEditTextInfo.setSelection(StringUtil.getLength(etEditTextInfo, true));
  }