【2.android】怀抱观古今,寝食展戏谑。这篇文章主要讲述2.android相关的知识,希望能为你提供帮助。
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();
}
}
});
推荐阅读
- 单页面跳转添加返回和跳转动画(仿app) 只对单页面和跳转有用,我用的是angualr,有不会的可以私信问我。
- Android 如何使edittext默认失去焦点
- springboot之配置文件application
- 取代Android(聊聊谷歌的Fuchsia新操作系统)
- android studio 2.3.3 最新 中文 汉化包 韩梦飞沙 安卓工作室 美化包
- Android使用Firebase
- 安卓7.1+wifi有叉问题解决
- Dapper系列之三(Dapper的修改与删除)
- Java将二进制转换为十进制