【问题标题】:Blackberry : PIMList.getFieldLabel(id) not working黑莓:PIMList.getFieldLabel(id) 不工作
【发布时间】:2013-01-31 18:24:10
【问题描述】:

我正在尝试检索黑莓设备中备忘录的所有字段。目前我正在我的模拟器 OS 5.0 中进行测试。我的代码如下:

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
                 }
              }
           }
        }

我面临的问题是,当执行最后一行时,它会抛出 ClassCastException。有人可以帮忙吗?非常感谢。

【问题讨论】:

    标签: blackberry memo


    【解决方案1】:

    抱歉,这么愚蠢的问题。我将代码行更正为:

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

    然后解决了。无论如何,谢谢。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多