Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
BlackBerry-如何将clickEvent(setChangeListener)添加到BlackBerry中的列表字段?_Blackberry - Fatal编程技术网

BlackBerry-如何将clickEvent(setChangeListener)添加到BlackBerry中的列表字段?

BlackBerry-如何将clickEvent(setChangeListener)添加到BlackBerry中的列表字段?,blackberry,Blackberry,我正在Blackberry中使用ListField,无法应用行。setChangeListener。 谁能帮帮我吗? 这是我的密码 Friendship objFriendship = new Friendship(); friends = objFriendship.FetchFriends(AATTGlobals.CURRENT_USER.getUserID()); rows = new Vector(); for (int x = 0; x < friends.leng

我正在Blackberry中使用
ListField
,无法应用
行。setChangeListener
。 谁能帮帮我吗? 这是我的密码

Friendship objFriendship = new Friendship();
  friends = objFriendship.FetchFriends(AATTGlobals.CURRENT_USER.getUserID()); 
  rows = new Vector();
  for (int x = 0; x < friends.length; x++) {
  String UserName = friends[x].getUserName();
  ProfilePicture = MISC.FetchUserProfilePicture(friends[x].getProfilePicturePath());
  String Location = friends[x].getLocation();
  TableRowManager row = new TableRowManager();
  row.add(new BitmapField(ProfilePicture));
  LabelField task = new LabelField(UserName,DrawStyle.ELLIPSIS)
   {
        protected void paint(Graphics graphics) {
         graphics.setColor(0x0099CCFF);
         super.paint(graphics);
        }
    };
  task.setFont(Font.getDefault().derive(Font.BOLD));
  row.add(task);
  row.add(new LabelField(Location,DrawStyle.ELLIPSIS)
   {
    protected void paint(Graphics graphics) {
     graphics.setColor(0x0099CCFF);
     super.paint(graphics);
    } 
  }
  );
row.setChangeListener( new FieldChangeListener() {
    public void fieldChanged(Field field, int context) {
        Dialog.alert("Row Clicked #");
    }
});

在tableRowManager中添加以下内容

    //for non touch
    protected boolean navigationClick(int status, int time) {
                    fieldChangeNotify(0);
                    return true;
                }
//for  touch
                protected boolean touchEvent(TouchEvent message) {
                    if (TouchEvent.CLICK == message.getEvent()) {
                        FieldChangeListener listener = getChangeListener();
                        if (null != listener)
                            listener.fieldChanged(this, 1);
                    }

                    return super.touchEvent(message);
                }

试试这个,让我知道它是否工作。

在tableRowManager中添加这个

    //for non touch
    protected boolean navigationClick(int status, int time) {
                    fieldChangeNotify(0);
                    return true;
                }
//for  touch
                protected boolean touchEvent(TouchEvent message) {
                    if (TouchEvent.CLICK == message.getEvent()) {
                        FieldChangeListener listener = getChangeListener();
                        if (null != listener)
                            listener.fieldChanged(this, 1);
                    }

                    return super.touchEvent(message);
                }

试试这个让我知道它是否工作。

我注意到,fieldChangeLister/FieldChanged没有被ListField UI调用[因为它适用于按钮和标签。]所以我认为ListField不支持FieldChanged


在navigationClick/TouchEvent()中,在FieldChange方法中写入您正在编写的操作。

我注意到,ListField UI不会调用fieldChangeLister/FieldChanged[因为它适用于按钮和标签。]因此我认为ListField不支持FieldChanged


在navigationClick/TouchEvent()中,在FieldChange方法中写入您正在编写的操作。

是否有错误消息?什么是TableRowManager?应用程序中的TableRowManager()是什么。请告诉我该代码,然后只有任何人可以帮助您。因此,请同时附加TableRowManager()代码。您确定要使用
ListField
?您提供的代码中没有
ListField
实例。是否有错误消息?什么是TableRowManager?应用程序中的TableRowManager()是什么。请告诉我该代码,然后只有任何人可以帮助您。因此,请同时附加TableRowManager()代码。您确定要使用
ListField
?您提供的代码中没有
ListField
实例。它不起作用。我们在别的地方写过其他代码吗?它不起作用。我们在其他地方写过其他代码吗?