private String strPsd = null;

private EditText edtPsd = null;

private CheckBox check = null;


// 弹出输入Wifi密码框

public String showPasswordDialog(int position) {


LayoutInflater inflater = getLayoutInflater();

View layout = inflater.inflate(R.layout.check_psd,

(ViewGroup) findViewById(R.id.check_layout));

edtPsd = (EditText) layout.findViewById(R.id.editText1_check);

check = (CheckBox) layout.findViewById(R.id.checkBox1_check);

check.setTextColor(Color.WHITE);

new AlertDialog.Builder(this)

.setView(layout)

.setMessage(R.string.inputpsd)

.setNegativeButton(R.string.cancel,

new DialogInterface.OnClickListener() {


public void onClick(DialogInterface dialog,

int which) {

}

})

.setPositiveButton(R.string.ok,

new DialogInterface.OnClickListener() {


public void onClick(DialogInterface dialog,

int which) {


}

}).show();


check.setOnCheckedChangeListener(new OnCheckedChangeListener() {

@Override

public void onCheckedChanged(CompoundButton arg0, boolean arg1) {

// TODO Auto-generated method stub

if(check.isChecked()){

edtPsd.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);

}else{

edtPsd.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

}

}

});

return strPsd;

}