final AlertDialog voipDialog;
voipDialog = builder.create();
voipDialog.setButton(DialogInterface.BUTTON_POSITIVE, "save", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String limitLengthStr = pstnLimitLengthEdittext.getText().toString().trim();
String prefixStr = pstnPrefixEdittext.getText().toString().trim();
try{
Field field = voipDialog.getClass().getSuperclass().getDeclaredField("mShowing");
field.setAccessible(true);
if(notNull(limitLengthStr, prefixStr)){
if(isNumericLimitLength(limitLengthStr)){
if(isNumericPrefix(prefixStr)){
save("voip_limit_length", pstnLimitLengthEdittext.getText().toString());
save("voip_prefix",pstnPrefixEdittext.getText().toString());
field.set(dialog, true);
}else{
Toast.makeText(CallFeaturesSetting.this, R.string.toast_prefix_allow, Toast.LENGTH_LONG).show();
field.set(dialog, false);
return;
}
}else{
Toast.makeText(CallFeaturesSetting.this, R.string.toast_limitlength, Toast.LENGTH_LONG).show();
field.set(dialog, false);
return;
}
}else{
Toast.makeText(CallFeaturesSetting.this, R.string.toast_notnull, Toast.LENGTH_LONG).show();
field.set(dialog, false);
return;
}
}catch (Exception e) {
Log.i(LOG_TAG, "NoSuchFieldException");
}
}
});
voipDialog.show();