码迷,mamicode.com
首页 > 移动开发 > 详细

2.android

时间:2017-09-05 19:16:54      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:const   add   else   basic   finish   code   idcard   ace   button   

ImageButton action_btn = (ImageButton) findViewById(R.id.action_btn);
action_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//数据校验//StringEx.isNull(mHouselist_houseid_view.getText().toString())||
if(isOperateAdd){
if(
StringEx.isNull(mDeptcode_view.getText().toString())
||StringEx.isNull(mFamilyorder_view.getText().toString())
||StringEx.isNull(mPname_view.getText().toString())
||StringEx.isNull(mIdnumber_view.getText().toString())
||StringEx.isNull(mMobile_view.getText().toString())){
Toast.makeText(EditPersonActivity.this,
"请输入完整信息", Toast.LENGTH_SHORT)
.show();

return;
}
}
else{
if(StringEx.isNull(mPname_view.getText().toString())
||StringEx.isNull(mIdnumber_view.getText().toString())
||StringEx.isNull(mMobile_view.getText().toString())){
Toast.makeText(EditPersonActivity.this,
"请输入完整信息", Toast.LENGTH_SHORT)
.show();
return;
}
}
//字符限制--身份证号
if(!StringEx.isNull(mIdnumber_view.getText().toString())){
try {
String a = IDCardAndMobile.IDCardValidate(mIdnumber_view.getText().toString());
if(("").equals(a)){
mIdnumber_view.setText(mIdnumber_view.getText().toString());
}else{
Toast.makeText(EditPersonActivity.this,
"身份证号输入错误", Toast.LENGTH_SHORT)
.show();
mIdnumber_view.setText("");
return;
}
}catch (ParseException e){
e.printStackTrace();
}
}
//字符限制--手机号
if(!StringEx.isNull(mMobile_view.getText().toString())){
try {
boolean a = IDCardAndMobile.isMobileNO(mMobile_view.getText().toString());
if(a){
mMobile_view.setText(mMobile_view.getText().toString());
}else{
Toast.makeText(EditPersonActivity.this,
"手机号码输入错误", Toast.LENGTH_SHORT)
.show();
mMobile_view.setText("");
return;
}
}catch (Exception e){
e.printStackTrace();
}
}
if(mBitmap==null){
Toast.makeText(EditPersonActivity.this,
"请点击照相", Toast.LENGTH_SHORT)
.show();
}else{
compressImageFile = Tools.compressImage(mBitmap);
new Thread(new Runnable() {
@Override
public void run() {
try {

jsonObject = new JSONObject();
jsonObject.put("singlefamily", mSinglefamily_view.getText());
jsonObject.put("houseid", mHouselist_houseid_view.getText());
jsonObject.put("familyorder", mFamilyorder_view.getText());
jsonObject.put("pname", mPname_view.getText());
jsonObject.put("relation", mRelation_view.getText());
jsonObject.put("gender", mGender_view.getText());
jsonObject.put("idnumber", mIdnumber_view.getText());
jsonObject.put("mobile", mMobile_view.getText());
jsonObject.put("persontype", mPersontype_view.getText());
jsonObject.put("religion", mReligion_view.getText());
jsonObject.put("maritalstatus", mMaritalstatus_view.getText());
jsonObject.put("military", mMilitary_view.getText());
jsonObject.put("education", mEducation_view.getText());
jsonObject.put("registertype", mRegistertype_view.getText());
jsonObject.put("remark", mRemark_view.getText());

String res;
Intent intent = new Intent();

if(isOperateAdd){
jsonObject.put("deptcode", mDeptcode_view.getText());
res = HttpClientUtil.getStringFromServer(Constants.SERVER_URL+"/personHouseHolder/addHouseHolderBasic_App.jspx", jsonObject, compressImageFile);
}
else {
jsonObject.put("personid", mPersonid);
res = HttpClientUtil.getStringFromServer(Constants.SERVER_URL+"/personHouseHolder/updateHouseHolderBasic_App.jspx", jsonObject, compressImageFile);
}

intent.putExtra("result", res);
setResult(RESULT_OK, intent);
finish();
} catch (JSONException e) {
e.printStackTrace();
} catch (IOException e){

}
}
}).start();
}
}
});

2.android

标签:const   add   else   basic   finish   code   idcard   ace   button   

原文地址:http://www.cnblogs.com/kaiwen/p/7479895.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!