如何在for循环中限制sqlite循环的结果?

时间:2015-11-02 17:45:43

标签: java android sqlite loops for-loop

我有4个无线电按钮嵌套在4个无线电组中。 answers_log字符串是sqlite查询的结果。查询从数据库4结果返回。我想在每个广播组中仅显示这4个结果。使用此代码,将显示16个结果,而不是在每个无线电组中显示4个单选按钮。我该如何解决这个问题?这是我的代码:

    answer = new RadioButton[4];
    radioGroup = new RadioGroup[4];
    for (int i = 0; i < 4; i++) {
        radioGroup[i] = new RadioGroup(this);
        radioGroup[i].setOrientation(RadioGroup.VERTICAL);
        for (Answer an : answers) {
            String answers_log = an.getAnswer();
            for (int j = 0; j < 4; j++) {
                answer[j] = new RadioButton(this);
                answer[j].setText(answers_log);
                answer[j].setId(j);
                radioGroup[i].addView(answer[j]);
            }
        }
        linearLayout.addView(radioGroup[i]);

谢谢!

1 个答案:

答案 0 :(得分:0)

routes.MapRoute(
  name: "ContactRequests_Operations",
  url: "ContactRequests-{operation}",
  defaults: new { controller = "Content", action = "Module_Direct", id =  "ContactRequests" , operation = "Get" }
  );

 routes.MapRoute(
    name: "Messages",
    url: "Messages",
    defaults: new { controller = "Content", action = "Direct", id ="Messages" }
);