|
|
|
ต้องการเช็คจำนวนรหัสไปรษณีย์ว่าให้กรอกได้แค่ 5 ตัว ต้องเขียนเช็คค่ายังไงค่ะ |
|
|
|
|
|
|
|
Code (Android-Java)
private void fn_btn_get_addr(){
ImageButton btn1 = (ImageButton)findViewById(R.id.btnconfirm);
btn1.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
String House_No, Alley, Road, Sub_District, District_Name, Province, Post_Code, Guidance;
EditText txt1 = (EditText) findViewById(R.id.editadd);
House_No = txt1.getText().toString();
EditText txt2 = (EditText) findViewById(R.id.editalley);
Alley = txt2.getText().toString();
EditText txt3 = (EditText) findViewById(R.id.editroad);
Road = txt3.getText().toString();
EditText txt4 = (EditText) findViewById(R.id.editdis);
Sub_District = txt4.getText().toString();
EditText txt5 = (EditText) findViewById(R.id.editsub);
District_Name = txt5.getText().toString();
EditText txt6 = (EditText) findViewById(R.id.editpro);
Province = txt6.getText().toString();
EditText txt7 = (EditText) findViewById(R.id.editpost);
Post_Code = txt7.getText().toString();
EditText txt8 = (EditText) findViewById(R.id.editgui);
Guidance = txt8.getText().toString();
if (House_No.equals("")) {
msbox("Japanese Food", "กรุณากรอกเลขที่บ้าน");
txt1.requestFocus();
} else if (Alley.equals("")) {
msbox("Japanese Food", "กรุณากรอกซอย");
txt2.requestFocus();
} else if (Road.equals("")) {
msbox("Japanese Food", "กรุณากรอกถนน");
txt3.requestFocus();
} else if (Sub_District.equals("")) {
msbox("Japanese Food", "กรุณากรอกแขวง");
txt4.requestFocus();
} else if (District_Name.equals("")) {
msbox("Japanese Food", "กรุณากรอกเขต");
txt5.requestFocus();
} else if (Province.equals("")) {
msbox("Japanese Food", "กรุณากรอกจังหวัด");
txt6.requestFocus();
} else if (Post_Code.equals("")) {
msbox("Japanese Food", "กรุณากรอกรหัสไปรษณีย์");
txt7.requestFocus();
} else if (Guidance.equals("")) {
msbox("Japanese Food", "กรุณากรอกแนะนำเส้นทาง");
txt8.requestFocus();
} else {
selectDB(House_No, Alley, Road, Sub_District, District_Name, Province, Post_Code, Guidance, GlobalVar1.Member_ID_Ref);
ChangPage1();
}
Tag : Java, Android
|
|
|
|
|
|
Date :
2015-08-10 05:49:50 |
By :
aei_candy |
View :
1075 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Post_Code.Length ครับ
|
|
|
|
|
Date :
2015-08-10 09:28:50 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|