How To SetFieldChangeListener for ListField in Blackberry?
I am new For Blackberry .. i need some Help. How To SetFieldChangeListener for 开发者_StackOverflowListField in Blackberry?
This way:
yourListField.setChangeListener(fieldChangeListenerInterfaceImplementation);
Implement FieldChangeListener and pass the implementation instance to setChangeListener();
listField = new ListField() {
protected boolean invokeAction(int action) {
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
<** apply your code here **>
}
});
return true;
};
public void focusChangeNotify(int index) {
mainlist = listField.getSelectedIndex();
listField.invalidate();
super.focusChangeNotify(index);
};
protected void onUnfocus() {
mainlistflag = true;
listField.invalidate();
super.onUnfocus();
};
protected void onFocus(int direction) {
mainlistflag = false;
super.onFocus(direction);
};
};
精彩评论