我在 android app.my 中开发。我的问题是我使用了警报对话框,并且我在 setsinglechoiceitems 中传递了值。但我无法传递价值。我下面的源代码。请给我解决方案。
public void AlertBoxShow(int position) {
int pos=position;
Log.v("log_tag"," position ::"+pos);
final CharSequence[] items = { " 5 ", " 10 ", " 15 "};
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
alt_bld.setSingleChoiceItems(items, -1,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case 0:
//updateStatus(pos);
dialog.dismiss();
// Your code when first option seletced
break;
case 1:
// Your code when 2nd option seletced
dialog.dismiss();
break;
case 2:
dialog.dismiss();
// Your code when 3rd option seletced
break;
}
}
});
AlertDialog alert = alt_bld.create();
alert.show();
}