Android AlertDialog 유의점
Android AlertDialog 유의점
일반적으로 alertdialog 를 메소드를 구성할때 alertdialog 자체가 thread로 적용됨을 유의 하여야 한다.
a() {
print 1;
b()
print 2;
}
b() {
alertDialog
}
위와 같이 a를 실행했을때 b메소드 실행후 alertdialog가 화면에 나타나지만 그순간 이마 print 2가 실행된다.
print 2가 b() 결과에 따른 실행정보일 경우 b() 정보에 포함해야 할 필요가 있다.
private void popupCustomerSelect(ArrayList
final CustomerObject objCu = objCustomer;
final ContractObject objCon = objContract;
final ArrayList
final String selectName = popupList.get(0).getName();
ArrayList
for (CustomerObject objCust : list) {
arrSelect.add(
"핸드폰 : "
+ (objCust.getMobile() == null ? "" : objCust.getMobile()) + "\n"
+ "주소 : "
+ objCust.getState() + " "
+ objCust.getCity() + " "
+ objCust.getState());
if (SSMApplication.DEBUG_MODE) {
Log.i(this.getClass().getName().toString(),"popupCustomerSelect.objCust getId : "+ objCust.getId());
}
} // 전화번호 주소 정보를 array 정보에 담기
String[] tempItem = new String[arrSelect.size()];
final String[] items = arrSelect.toArray(tempItem);
new AlertDialog.Builder(mContext)
.setTitle(selectName + "님의 update 대상 정보를 선택하세요")
.setIcon(R.drawable.icon)
.setSingleChoiceItems(items, popupCheckedItem,
new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int which) {
popupCheckedItem = which;
}
})
.setPositiveButton("수정",
new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int whichButton) {
if (SSMApplication.DEBUG_MODE) {
Log.i(this.getClass().getName().toString(),"popupCustomerSelect.popupCheckedItem : "+ popupCheckedItem);
}
if (popupCheckedItem > 0) {
selectCustId = popupList.get(popupCheckedItem -1).getId();
} else {
selectCustId = popupList.get(0).getId();
}
// 고개정보 및 계약정보 update process
objCu.setId(selectCustId); // 신규 고객 데이터에 id 정보를 셋팅
objCu.updateAll(); // 신규 고객 데이터 전체 변경
if ((objCon.getCertificate() != null)) {
objCon.setCust_id(objCu.getId());
objCon.insert(); // 계약 정보에 대한 중복 유무를 배제 하고 무조건 insert 하는 형태로 수정
}
}
})
.setNegativeButton("추가",
new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int whichButton) {
selectCustId = 0;
// 고개정보 및 계약정보 insert process
objCu.setAddr_flag("U");
objCu.insert();
if ((objCon.getCertificate() != null)) {
objCon.setCust_id(objCu.getId());
objCon.insert(); // 계약 정보에 대한 중복 유무를 배제 하고 무조건 insert 하는 형태로 수정
}
}
})
.show();
}
댓글
댓글 쓰기