2012-09-14 53 views
1

我开发了简单的代码来在黑莓屏幕上显示图片和标题,但是我无法显示任何东西(但是如果我测试了标题,只有它正在工作)。无法在黑莓手机上显示图片

我的要求是在列表中显示带标题的图像。

我按照this link for fetching image from image url

,在这里我在drawlistrow方法代码:

public void drawListRow(ListField list, Graphics g, int index, int y, int w) 
     { 
      String text = (String)listElements.elementAt(index); 
      Bitmap image =GetImage.connectServerForImage("http://toucheradio.com/toneradio/iphone/toriLite/toriLive.png"); 
      g.drawLine(0, y, w, y); 

      g.drawText(text, 150, y, 60, w); 
      g.drawBitmap(0,y,image.getWidth(),image.getHeight(),image,0,0); 
     } 

可能是什么问题呢?

回答

3

如果图像的高度和宽度大于屏幕分辨率,请检查图像的高度和宽度,然后您必须裁剪或放大所获得的图像。给drawBitmapMethod一些x轴,我只是给你下面的想法,你可以实现。

g.drawBitmap(340, y, image.getWidth(), image.getHeight(), image, 0, 0); 
+0

我得到了需求,如果追加;在我的形象的Web URL这样imageweburl +结尾(“装置侧=真”),以“;装置侧= true”,则是工作 – String

+0

我会建议你阅读http://supportforums.blackberry.com/t5/Java-Development/deviceside-true/td-p/54164 – BBdev