¸ÞÀÎÆäÀÌÁö¿¡¼ 1~12°³ÀÇ º¸±â¼±ÅÃÇؼ ³Ñ¾î°¡´Â°Å°í ¼±Åà ¾ÈÇßÀ»½Ã¿¡ ¼±ÅÃÇ϶ó°í ¸Þ¼¼Áö ¶ç¿ì´Âµ¥
º¸±â1¹øÀ» ¼±ÅÃÇϸé ÀÚ²Ù ¼±ÅþÈÇß´Ù°í ¶ß³×¿ä..
¹¹°¡ ¹®Á¦Àΰ¡¿ä ¤Ð¤Ð
public class MainActivity extends Activity {
Activity act = this;
Intent intent;
EditText etItem1;
Button btnSelect;
Button btnSend;
int selectChoice;
int selectTemp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.av_main_activity);
selectChoice = 0;
final CharSequence[] choice = new CharSequence[]{"1¿ù","2¿ù","3¿ù","4¿ù","5¿ù","6¿ù","7¿ù","8¿ù","9¿ù","10¿ù","11¿ù","12¿ù"};
btnSelect = (Button) act.findViewById(R.id.btn_select);
btnSend = (Button) act.findViewById(R.id.btn_send);
btnSelect.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
new AlertDialog.Builder(act)
.setTitle("¸î¿ùÀÎÁö °í¸£½Ã¿À")
.setSingleChoiceItems(choice, -1, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
selectTemp = whichButton;
}})
.setPositiveButton("¼±ÅÃ", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
selectChoice = selectTemp;
btnSelect.setText(choice[selectChoice]);
}
})
.setNegativeButton("´Ý±â", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
}).show();
}
});
btnSend.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
if(selectChoice == 0){
new AlertDialog.Builder(act)
.setTitle("¼±ÅøÕÀú Çϼ¼¿ä")
.setPositiveButton("´Ý±â", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}}).show();
}else{
intent = new Intent(act, SubActivity.class);
intent.putExtra("abc", selectChoice);
startActivity(intent);
}
}
});
}
} | |
|