2011-11-04 45 views
2

如何打開黑莓中的選定列表字段?BlackBerry ListField - 如何打開選定的列表項

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()); 
} 

回答

1

覆蓋navigationclick方法,並點擊,撥打listNames.getSelectedIndex();

+0

它應該是'field.getSelectedIndex()'而不是'listNames.getSelectedIndex();' – BBdev

1

,你可以在你所添加的ListField類重寫navigationClick(int status, int time)方法......在屏幕

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

} 
相關問題