Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Forums Advisor I
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10
Accepted Solution

Problem in encodedimage

Hi i want to display 20 encoded images using grid field manager.

Here is the code...

 

GridFieldManager grid;
         grid = new GridFieldManager(5,4,0);
        
         EncodedImage[] e= new EncodedImage[20];
         for(int i=1;i<e.length;i++)
         {
             e[i].getEncodedImageResource("1.jpg");
            
         }
         for(int i=1;i<e.length;i++)
         {
             grid.add(new BitmapField(e[i].getBitmap())); //error in this
         }
         add(grid);

 

 

can anyone tell me the problem.??

Developer
Posts: 16,740
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Problem in encodedimage

check if the line with "1.jpg" returns a valid encoded image.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Forums Advisor I
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

Re: Problem in encodedimage

yes its returning the valid encoded image still i am not getting the output

Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Problem in encodedimage

I would have coded this:

e[i].getEncodedImageResource("1.jpg");

as this:

e[i] = EncodedImage.getEncodedImageResource("1.jpg");

 

In fact I would have created a Bitmap array rather than an EncodedImage array and used

Bitmap.getBitmapResource(...);

but I think either will work.