I want my BlackBerry app to open a website when I focus on its name.
Can anybo开发者_开发知识库dy tell me how to do that?
final LabelField label = new LabelField(url,LabelField.FOCUSABLE);
label.setFocusListener(new FocusChangeListener(){
public void focusChanged(Field field, int eventType) {
if(eventType == FOCUS_GAINED){
BrowserSession bSession = Browser.getDefaultSession();
bSession.displayPage(label.getText());
}
}
});
add(label);
精彩评论