protected void onListItemClick(int position) {
final int pos = position;
AlertDialog dlg = new AlertDialog.Builder(this).setTitle(R.string.team_change).setItems(items, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == 0) {
sendMSG(pos);
} else if (which == 1) {
changeIcon(pos);
} else if (which == 2) {
if (isLeader) {
changeLeader(pos);
}
}
}
}).create();
dlg.show();
}
pos是点击弹出的列表的行号,再通过对pos的辨别分别作不做的操作,初学安卓不久,一点点的小技术使用都是一个进步,坚持下去就是胜利!