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
Developer
Posts: 445
Registered: ‎07-15-2008
My Device: Not Specified

Display Image from URL in Application

G'day!

I have an application with some BitmapFields and some LabelFields and I would need to display an image (in png) from a website (www.mypage.com/images/logo.png) in one of the BitmapFields in my application.

How do I do that?

 

When I add an image from the resource, I add it like that:

 

 

add(new BitmapField(Bitmap.getBitmapResource( "image.png" ),BitmapField.FIELD_LEFT));

 

Can someone help me on how to add it from the internet/url?

 

Thanks!

 

 

If your question was answered, please accept it as a sollution and / or give Kudos ;-)
______________________________
Use the Search Field first! Maybe the question you want to ask already exists!
Developer
Posts: 212
Registered: ‎07-18-2008
My Device: Storm 9550

Re: Display Image from URL in Application

you would probably have to get it by yourself:

 

HttpConnection conn = (HttpConnection)Connector.open(http://www.mypage.com/images/logo.png);

 

the call openInputStream() to get the data, read it into a buffer and then create your bitmap with

Bitmap.createBitmapFromBytes


If your problem was solved, please mark answer as "Accepted solution"
If your want to thank, click the "kudo" symbol
___________
visit me: http://mobilejavadevelopment.blogspot.com/
visit the Berlin BlackBerry Developer Group: http://berlinblackberrydevelopers.blogspot.com/
Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Display Image from URL in Application