BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-18-2008, 04:13 AM   #1 (permalink)
Knows Where the Search Button Is
 
krmlkr's Avatar
 
Join Date: Jul 2008
Model: 8320
PIN: N/A
Carrier: Airtel
Posts: 19
Post Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up Image drawing problem...

Please Login to Remove!

Hi,

I am developing an application in which I invoked the native camera. Using this I took a snap. Then I am trying to retreive the same picture on next screen.
I am able to read the Image but when I display (add) on screen it show only some part of Image.
I am not able to get which parameter should I change or use to get the exact picture.

Here is my code...

Code:
public PictureViewer() 
{  
        MainScreen main = new MainScreen();
        
        // invoke the BlackBerry Camera.
        Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, new CameraArguments());

        try {
            FileConnection fconn = (FileConnection)Connector.open("file:///store/home/user/pictures/IMG00001.jpg");    //"file:///store/samples/pictures/DuskClouds.jpg"
            // If no exception is thrown, then the URI is valid, but the file may or may not exist.
            if (fconn.exists()) {
                InputStream input = fconn.openInputStream();
                int available = input.available();
                byte[] data = new byte[available];
                input.read(data, 0, available);
                EncodedImage image = EncodedImage.createEncodedImage(data,0,data.length);
                Bitmap b = image.getBitmap();
                BitmapField picture = new BitmapField(b);
                main.add(picture);
                main.add(new LabelField("Data Length:" + data.length));
            }
            else {
                main.add(new LabelField("Picture does not exist"));
            }
            fconn.close();
        }
        catch (Exception ioe) {
            main.add(new LabelField("Error::"+ioe));
        }
        pushScreen(main);
    }
Please help me solve this problem...

Thanks & regards,
Krmlkr
Offline  
Old 01-08-2009, 10:57 AM   #2 (permalink)
New Member
 
Join Date: Oct 2008
Model: 8800
PIN: N/A
Carrier: Turkcell
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Suffering badly with the same problem.

Any idea?? i mean any..
Offline  
Old 01-09-2009, 09:57 AM   #3 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

maybe you should first resize your EncodedImage before getting the Bitmap from it. Otherwise you are trying to put a HiRes image in a very small field....
__________________
Blessed is the end user who expects nothing, for he/she will not be disappointed. (Franklin's Rule)
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.