2.android

Posted 智云

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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();
}
}
});



















































































































以上是关于2.android的主要内容,如果未能解决你的问题,请参考以下文章

谷歌浏览器调试jsp 引入代码片段,如何调试代码片段中的js

片段和活动之间的核心区别是啥?哪些代码可以写成片段?

VSCode自定义代码片段——.vue文件的模板

VSCode自定义代码片段6——CSS选择器

VSCode自定义代码片段——声明函数

VSCode自定义代码片段8——声明函数