概念說明
Source code:
http://ifile.it/omyigxk/HelloAndroid-addDialog-YesNo.rar
or
http://dl.dropbox.com/u/2452511/HelloAndroid-addDialog-YesNo.rar
差異的部份:
setPosiiveButton and setNegativeButton的第一個參數
可以帶入一般的string - "No"
or是定義在strings.xml內的ide - R.string.string_yes
abLeftDialog.setPositiveButton(R.string.string_yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//Toast.makeText(this, "You press the yes button", Toast.LENGTH_LONG);
}
});
abLeftDialog.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
將string_yes設定到strings.xml
沒有留言:
張貼留言