private
void
AlertDialogList(String alertNm,
final
String alertId, CharSequence charDept) {
AlertDialog.Builder builder =
new
AlertDialog.Builder(
this
, AlertDialog.THEME_HOLO_DARK);
builder.setTitle(alertNm).setCancelable(
true
).setAdapter(setAdapter(alertId, charDept),
new
DialogInterface.OnClickListener() {
public
void
onClick(DialogInterface dialog,
int
position) {
try
{
topBar_dialog_flg =
true
;
if
(alertId.equals(
"firstLab"
)){
String exrm_nm = ((JSONObject)labList.get(position)).getString(
"EXRM_NM"
);
((Button)findViewById(R.id.btnFirstLab)).setText(exrm_nm);
firstTabCode = ((JSONObject)labList.get(position)).getString(
"EXRM_TP_CD"
);
secondTabCode=
""
;
((Button)findViewById(R.id.btnSecondLab)).setText(
"검사실 전체"
);
}
else
if
(alertId.equals(
"secondLab"
)){
String exrm_nm = ((JSONObject)labList.get(position)).getString(
"EXRM_NM"
);
((Button)findViewById(R.id.btnSecondLab)).setText(exrm_nm);
secondTabCode = ((JSONObject)labList.get(position)).getString(
"EXRM_TP_CD"
);
}
}
catch
(Exception e) {
showToast(e.getMessage());
}
}
});
}
private
AlertdialogAdapter setAdapter(String alertId, CharSequence charDept) {
AsyncTaskAlertDialog asyncTaskAlertDialog =
new
AsyncTaskAlertDialog();
try
{
labList =
new
JSONArray(asyncTaskAlertDialog.execute(alertId).get().toString());
}
catch
(Exception e) {
showToast(e.getMessage());
}
return
new
AlertdialogAdapter(
this
, R.layout.alertdialog_list_layout, labList,
"EXRM_NM"
,
"EXRM_TP_CD"
);
}
private
class
AsyncTaskAlertDialog
extends
AsyncTask<Object, Object, Object>{
@Override
protected
Object doInBackground(Object... params) {
~~~~
}
}