public Image getImageFromUrl(String url)
{
InputStream is = null;
HttpConnection hc = null;
Image img = null;
try {
hc = (HttpConnection)Connector.open(url);
// If we've got a connection?
if (hc.getResponseCode() == HttpConnection.HTTP_OK) {
// Open the stream
is = hc.openInputStream();
// How big is the file?
int len = (int)hc.getLength();
// Create a byte array that size
byte[] data = new byte[len];
// Read in the file
int actual = is.read(data);
// Create an image from the raw data
img = Image.createImage(data, 0, len);
}
} catch (Exception e) {
System.out.println("IO Exception+"+e);
} finally {
if (is != null) {
try {
is.close();
}
catch (Exception e) { }
}
if (c != null)
{
try {
c.close();
}
catch (Exception e) { }
}
return img;
}
Thursday, July 13, 2006
J2ME Image Loader Source Code
Posted by
bulletproof
1 comments
Labels: code samples, developer, example, how to, how-to, image, mobile, resource, source code
Wednesday, July 12, 2006
Screen Capture for UIQ (Sony Ericsson P800/P900)
SCap for the SonyEricsson P800/P900 allows you to capture the full screen of a P800/P900 and save it to file. Start screen capture by selecting Start capture from the SCap menu, then use the hotkey to capture the screen. The images are stored in a folder called scap and you can use the P800/P900 Pictures application to view them. SCap can take screenshots in both Flip Open and Flip Closed.
Featurelist:
- File format: Save screenshots as 24-bits bmp, 8-bits bmp, gif or jpg. For jpg you can configure the image quality (and thus the file size).
- Location: You can configure screenshots to be stored on either the internal disk or the Memory Stick.
- Filename: You can specify the base file name of the screenshot image files. SCap will append a unique number to the base filename. For example, the default base file name is screen and the default image type is jpg, so images are called screen.jpg, screen-1.jpg etc.
- Hotkeys: Select Camera button, Browser button, Power button or Jog dial select as the hotkey.
- Auto/manual stop: You can configure SCap to either automatically stop the capturing after you've taken a screenshot (and thus release the hotkey to its normal use) or to leave it on until you manually select Stop capture from the SCap menu. This is handy if you want to take several screenshots.
- Visual feedback: If you enable visual feedback you get a small popup to say SCap is saving the image and a popup to say it is done. You can disable them which is usefull when taken screenshots of games such as EDoom or EMame as these popups will take these games out of their full screen mode.
- Audible feedback: You may select an audio file to be played after the screen capture is fully completed. Audible and visual feedback are usefull because for example saving a screenshot as gif on the memory stick may take 10 seconds. In that period you cannot take another screenshot.
Posted by
bulletproof
0
comments
Labels: application, bmp, developer, file format, full screen, gif, image, jpg, mobile, multimedia, P800, P900, Scap, screen capture, Sony Ericsson
Sunday, July 09, 2006
Micro-Mini Projector from Light Blue Optics
And we thought projectors were getting small when they were the size of a Mac mini! Light Blue Optics has created a micromini projector that's the size of—wait for it—a matchbox, and it s going to be used with a cellphone. Its secret is new PVPro technology, an automechanical process that is adept at scaling lower resolution images to higher resolutions. PVPro can also take care of pesky annoyances such as keystoning. These capabilities come in awfully handy when you're trying to project a video image onto a nearby wall with a cellphone.
Light Blue Optics is determined to make it easier for cellphone users to share photos with friends and comfortably watch movies on a screen that's considerably larger than a postage stamp.
Posted by
bulletproof
0
comments
Labels: cellphone, image, mobile, multimedia, projector, video