解析服务器查询列表然后添加到容器列表

Parse Server querying a list then adding to a Container list

我的 parse4cn1 API 终于可以使用代号一了!我很高兴它有效,但我在从查询中获取列表然后将其添加到容器列表以便显示在我的应用程序屏幕上时遇到问题。

我使用这个菜单在数据库中添加数据:

public void addMenu() {

        final Form addMenu = new Form("Menu");
        addMenu.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

        Button back = new Button("Back to Main Menu");

        ParseObject po = ParseObject.create("mytable");

        List<String> list = new ArrayList<String>();
        list.add("Book's Title: " + "Iron Maiden");
        list.add("Book description: " + "Heavy Metal");
        list.add("Author: " + "Bruce");
        list.add("Donor: " + "Unknown");
        list.add("Date of subscription: " + "29/03/2018");
        list.add("Book Status: " + "Available");

        po.put("codeID", list);

        try {

            po.save();

        } catch (com.parse4cn1.ParseException e) {

            Dialog.show("Err", "Something went wrong.", "OK", null);
        }

        addMenu.add(back);
        addMenu.show();    

        back.addActionListener(new ActionListener() 
        {
            public void actionPerformed(ActionEvent ev) 
            {
                new StateMachine("/theme");
            }
        });
    }

然后我用这个菜单查询数据回来:

public void infoMenu() {

            final Form infoMenu = new Form("Book Info");
            infoMenu.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

            Container list = new Container();
            list.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
            list.removeAll();

            Button back = new Button("Back to Main Menu");

            ParseQuery<ParseObject> query = ParseQuery.getQuery("mytable");
            query.whereExists("codeID");

            List<ParseObject> results = null;

            try {

                results = query.find();
                //HOW TO ADD RESULTS TO THE CONTAINER LIST?

            } catch (com.parse4cn1.ParseException e) {

                Dialog.show("Err", "Something went wrong.", "OK", null);
            }

            infoMenu.add(list);
            infoMenu.add(back);
            infoMenu.show();

    back.addActionListener(new ActionListener() 
    {
        public void actionPerformed(ActionEvent ev) 
        {
            new StateMachine("/theme");
        }
    });
}

我的问题是如何将结果添加到容器列表?

if(!results.isEmpty()) {    
   int index = 0;       
   int size = results.size();
   for(;index < size;++index) {
   list.add(btn = new 
   MultiButton(results.get(index).getString("Title")));
   addListener(btn);
}