BlackBerry ListField - 如何打开所选列表项

时间:2011-11-04 10:25:47

标签: blackberry java-me

如何在黑莓手机中打开所选列表字段?

    listNames = new Vector();
    field = new ListField();

    ListCallBack _callback = new ListCallBack();
    field.setCallback(_callback);
    add(field);
    intialseList();
}

private void intialseList() {
    String name = "Sriaknth";
    String name2 = "pradeep";

    listNames.addElement(name);
    listNames.addElement(name2);
    reloadList();

}

private void reloadList() {
    field.setSize(listNames.size());
}

2 个答案:

答案 0 :(得分:1)

您可以在已添加ListField的类中覆盖navigationClick(int status, int time)方法...

protected boolean navigationClick(int status, int time) {
    if(field.getSelectedIndex());
            return true;

}   

答案 1 :(得分:1)

在屏幕中覆盖navigationclick方法,点击后,拨打listNames.getSelectedIndex();