c语言case的值能动态修改吗,java中的switch case语句中,case所对应的数目是不确定的,能否动态改变case...
現在方法中傳入的menuList的數目是不確定的,每個menuList.get(i),都對應一個runnableList.get(i)。現在需要根據menuList.size()動態改變case的數目,求思路
public boolean Confim(final Activity act, String title, final String[] menuList, final List runList) {
runnableList = runList;
AlertDialog.Builder builder = new AlertDialog.Builder(act);
builder.setTitle(title);
builder.setItems(menuList, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int which) {
switch (which) {
case 0:
if (runnableList.get(0) == null) return;
runnableList.get(0).run();
break;
case 1:
if (runnableList.get(1) == null) return;
runnableList.get(1).run();
break;
case 2:
if (runnableList.get(2) == null) return;
runnableList.get(2).run();
break;
}
}
});
builder.show();
return false;
}
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的c语言case的值能动态修改吗,java中的switch case语句中,case所对应的数目是不确定的,能否动态改变case...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何从一张图片里取出其中一部分_如何鉴别
- 下一篇: mysql binlog update_