Black Berry Table View

∥☆過路亽.° 提交于 2019-12-06 04:32:52
Maksym Gontar

There is a nice GridFieldManager by Anthony Rizk.

Code:

    public void list()
    {
        if (null != mGrid && null != mGrid.getManager())
            mGrid.getManager().delete(mGrid);
        int colWidth = net.rim.device.api.system.Display.getWidth() / 4; 
        mGrid = new GridFieldManager(new int[] { 0, colWidth, colWidth,
                colWidth, colWidth }, VERTICAL_SCROLL | VERTICAL_SCROLLBAR);
        mGrid.add(new NullField(FOCUSABLE));
        mGrid.add(new LabelField("Name"));
        mGrid.add(new LabelField("E-Mail"));
        mGrid.add(new LabelField("Gender"));
        mGrid.add(new LabelField("Active"));
        add(mGrid);
        _data = (Vector) store.getContents();
        try {
            int sn = 0;
            for (int i = _data.size() - 1; i > -1; i--, sn++) {

                StoreInfo info = (StoreInfo) _data.elementAt(i);
                // checking for empty object
                if (!_data.isEmpty()) {
                    // if not empty
                    // create a new object of Store Info class

                    // storing information retrieved in strings
                    firstUserName = (info.getElement(StoreInfo.NAME));
                    lastUserName = (info.getElement(StoreInfo.LastNAME));
                    userEmail = (info.getElement(StoreInfo.EMail));
                    userGender = (info.getElement(StoreInfo.GenDer));
                    userStatus = (info.getElement(StoreInfo.setStatus));

                    // calling the listAll method
                    mGrid.add(new NullField(FOCUSABLE));
                    mGrid.add(new LabelField(firstUserName + " "
                            + lastUserName));
                    mGrid.add(new LabelField(userEmail));
                    mGrid.add(new LabelField(userGender));
                    mGrid.add(new LabelField(userStatus));
                }

            }
        } catch (Exception e) {
        }

    }

See also BlackBerry Grid Layout Manager updated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!