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
Java blackberry设备中的代码运行缓慢_Java_Blackberry - Fatal编程技术网

Java blackberry设备中的代码运行缓慢

Java blackberry设备中的代码运行缓慢,java,blackberry,Java,Blackberry,我有一些代码在blackberry设备中运行良好,但出人意料地运行缓慢 public ContactsScreen()//(Object _app) { setTitle(new LabelField( "Contacts",LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH)); //_contactNamesVector = new Vector(); _contactVector = new

我有一些代码在blackberry设备中运行良好,但出人意料地运行缓慢

public ContactsScreen()//(Object _app)
    {

     setTitle(new LabelField( "Contacts",LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH));     


       //_contactNamesVector = new Vector();
    _contactVector = new Vector();
    _contacts = getContactListInVector();
       //ReadableList _readableList =(ReadableList) _contacts;
    if(_contacts != null)
    {
     // Create an instance of our SortedReadableList class. 
   //it takes _contacts as vector and then sort it accordingly

     _contactSortedList = new ContactSortedList(_contacts);        

     // Add our list to a KeywordFilterField object.
     _keywordFilterField = new KeywordFilterField()
     {

      protected boolean navigationClick(int status,int time)
      {      
       int index = getSelectedIndex();

       //Return data in redableklist format ie collectionlist and boolean
       ContactInfo data = (ContactInfo)getSelectedElement();
       data.toggleChecked();
       invalidate(index);
       if(data.isChecked())
       {
         // UiApplication.getUiApplication().popScreen(getScreen());
          data.displayMultipleContacts();

        //String str1 = data.getCompanyName();
        //Dialog.alert(str1);
        //String str2 = data.getFirstName();
        //Dialog.alert(str2);
        //String str3 = data.getLastName();
        //Dialog.alert(str3);
        //String str4 = str1.concat(str2).concat(str3);

       }
       return true;
      }
//       public boolean keyChar(char key, int status, int time){
//        if(key == Keypad.KEY_ENTER){
//        int index = getSelectedIndex();
//          //Return data in redableklist format ie collectionlist and boolean
//          ContactInfo data = (ContactInfo)getSelectedElement();
//          data.toggleChecked();
//          invalidate(index);
//          if(data.isChecked())
//          {
//            // UiApplication.getUiApplication().popScreen(getScreen());
//             data.displayMultipleContacts();
//           
//           //String str1 = data.getCompanyName();
//           //Dialog.alert(str1);
//           //String str2 = data.getFirstName();
//           //Dialog.alert(str2);
//           //String str3 = data.getLastName();
//           //Dialog.alert(str3);
//           //String str4 = str1.concat(str2).concat(str3);
//           
//          }
//         
//        }
//        if(key == Keypad.KEY_ESCAPE){
//         UiApplication.getUiApplication().popScreen(getScreen());
//         
//        }
//        return true;
//       }

     };
     _keywordFilterField.setSourceList(_contactSortedList,_contactSortedList);      

   //register keywordfield with Callbackinterface list display, it call methods of callback 
     _keywordFilterField.setCallback(_contactSortedList);


     _contactSortedList.setReadableList(_keywordFilterField.getResultList());

     // We're providing a customized edit field for
     // the KeywordFilterField.
     CustomKeywordField customSearchField = new CustomKeywordField();
     _keywordFilterField.setKeywordField(customSearchField);        



     // We need to explicitly add the search/title field via MainScreen.setTitle().
     this.setTitle(_keywordFilterField.getKeywordField());            

     // Add our KeywordFilterField to the screen and push the screen
     // onto the stack.
     this.add(_keywordFilterField);
    }

    }

Eclipse For BlackBerry中有一个集成的探查器,您试用过吗?在使用探查器之前,请尝试使用此方法测量不同操作的时间。例如,检查getContactListInVector()调用需要多长时间,然后使用ContactSortedList对联系人进行排序需要多长时间。