AlertDialog中的样式设置

实例:

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("选择货币类型");
QuitApp quitApp = new QuitApp("currency");
builder.setItems((String[]) currencyName
.toArray(new String[currencyName.size()]), quitApp);
AlertDialog dialog = builder.create();
dialog.show();

 

private class QuitApp implements
android.content.DialogInterface.OnClickListener {

String qtype;

public QuitApp(String type) {
qtype = type;
}

@Override
public void onClick(DialogInterface dialog, int which) {
if (qtype == "currency") {
currency_code = ((String[]) currencyCode
.toArray(new String[currencyCode.size()]))[which];
} else if (qtype == "region") {
REGION_CODE = ((String[]) regionCode
.toArray(new String[regionCode.size()]))[which];
}
removeAllSubNavItem();
MainActivity.this.onResume();
}

}

你可能感兴趣的:(AlertDialog)