1

I developed simple code to display an image and title on blackberry screen, but I am not able to display anything (but if I tested for title only it is working).

My requirement is to display image with title in a list.

I have followed this link for fetching image from image url

and here my code in drawlistrow method:

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

What could be the problem?

4

1 に答える 1

3

また、画面の解像度よりも大きい場合は、画像の高さと幅を確認してください。取得している画像をトリミングまたは拡大する必要があります。drawBitmapMethod に x 軸を与えます。以下のようなアイデアを実装できます。

g.drawBitmap(340, y, image.getWidth(), image.getHeight(), image, 0, 0);
于 2012-09-14T10:29:08.253 に答える