0

I'm trying to retrieve all fields of a Memo in blackberry device. At the moment I'm testing in my simulator OS 5.0. My code below:

StringBuffer sb = new StringBuffer();
BlackBerryMemo item = null;         
     while(memos!=null && memos.hasMoreElements()){          
         item = (BlackBerryMemo) memos.nextElement();            
         int[] fieldIds = item.getFields();
           int id;
           for(int index = 0; index < fieldIds.length; ++index) 
           {
              id = fieldIds[index];
              if(item.getPIMList().getFieldDataType(id) == PIMItem.STRING) 
              {
                 for(int j=0; j < item.countValues(id); ++j) 
                 {
                    String value = item.getString(id, j);                       
                    sb.append(((PIMList) item).getFieldLabel(id) + " = " + value); //problem here
                 }
              }
           }
        }

The problem I'm facing is that when the last line is executed, it throws ClassCastException. Can some one please help? Thanks a lot.

nikita sharma
  • 169
  • 1
  • 8

1 Answers1

0

Sorry, such a silly question. I corrected the line of code to:

sb.append((item.getPIMList()).getFieldLabel(id) + " = " + value));

And it was solved. Thanks anyways.

nikita sharma
  • 169
  • 1
  • 8