我在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();
}