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
BHS
New Contributor
Posts: 6
Registered: ‎02-24-2011
My Device: Not Specified

Problem posting images

[ Edited ]
I am developing an app to publish news and I have a database with the data of some companies which will pay for banner displays.

What would be the best method to publish these banners?

I was thinking of creating the on a web server and the present them in the following way:

String img = "http://www.serverXYZ.com/image.jpg";
try {
	HttpConnection connection = (HttpConnection) Connector
			.open(img);
	int response = connection.getResponseCode();
	if (response == HttpConnection.HTTP_OK) {
		InputStream is = connection.openInputStream();
		int length = is.available();
		byte[] data = new byte[length];
		data = IOUtilities.streamToBytes(is);
		is.close();
		connection.close();
		objBanner = Bitmap.createBitmapFromBytes(data, 0,
				data.length, 1);
	}
} catch (Exception e) {
	System.out.println("Exception From Thread" + e);
}

The problem is that the download is rather slow.

I would appreciate any help with this.

P.S. I have been reading about Advertising Service but I’m not sure if this would solve my problem since I want to get paid directly by the companies and I don’t know if they would allow me to upload my own images.
BHS
New Contributor
Posts: 6
Registered: ‎02-24-2011
My Device: Not Specified

Post image

[ Edited ]
Any idea??
BHS
New Contributor
Posts: 6
Registered: ‎02-24-2011
My Device: Not Specified

Re: Post image

Any idea?

Highlighted
Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Post image

We have to do this because we want a ad scheme as you want to do. Basically one separate thread loads the banners. The banners must be as small as possible and enclosed in your app a default ad if you get connection problems...