View Single Post
Old 07-23-2009, 01:27 PM   #1 (permalink)
New Member
Join Date: Jun 2009
Model: 7100T
Carrier: hi
Posts: 6
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with sending image to blackberry

Please Login to Remove!


I'm trying to send a small image (PNG or JPG) from my computer to my blackberry simulator via a socket. The entire image seems to transfer fine, the problem arises when I try to display it, by calling:
EncodedImage.createEncodedImage(data, 0, data.length);
// or
Bitmap.createBitmapFromBytes(data, 0, -1, 0);
// or
Bitmap.createBitmapFromPNG(data, 0, -1);
I keep getting an IllegalArgumentException error when I call any of these functions with the byte[] that I pass into the constructor of my derived MainScreen class. I don't know what else to do; I've looked up countless other forum posts and used their code to transfer, and it still doesn't work. Here's how I'm connecting to the server:

SocketConnection sc = (SocketConnection)"socket://<my computer's IP>:5000;deviceside=true");
Please let me know if you guys need any more information. The simulator I'm using is for the BB Storm, and I can copy all the code for both the server and the simulator if needed. I am desperate to find a solution for this.

Offline   Reply With Quote