BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 03-07-2010, 04:12 PM   #1 (permalink)
New Member
 
Join Date: Mar 2010
Model: 9000
PIN: N/A
Carrier: STUDENT
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Put picture in background

Please Login to Remove!

Hello

I am sorry for my english, i am french

I need help for my application. I want to put a picture in background of my application. The picture is taken with camera. But it don't work and i can't understand why.

Help me please :'(

My code :
PHP Code:
  private VerticalFieldManager _manager;

   
_manager = (VerticalFieldManager)getMainManager();
                
Background bg BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("file:///store/home/user/pictures/IMG00004-20100307-1112.jpg"));
                
_manager.setBackground(bg); 
The file "IMG00004-20100307-1112" exists but i can't display it. Why?

tHank
Offline  
Old 03-07-2010, 06:59 PM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

You cannot use the Bitmap.getBitmapResource() with a file connection. This method expects the path of a bitmap that is embedded in the COD file.

To load in this fashion, you wil geed to use FileConneciton and InputStream, then use createFromBytes(), or utilize EncodedImage.
Offline  
Old 03-09-2010, 06:41 PM   #3 (permalink)
New Member
 
Join Date: Mar 2010
Model: 9000
PIN: N/A
Carrier: STUDENT
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Dougsg38p View Post
You cannot use the Bitmap.getBitmapResource() with a file connection. This method expects the path of a bitmap that is embedded in the COD file.

To load in this fashion, you wil geed to use FileConneciton and InputStream, then use createFromBytes(), or utilize EncodedImage.

Thank, i will auto respond

I use this code to draw a picture from phone and it work:

PHP Code:
 public void paint(Graphics g) {
        try {
            
FileConnection fconn = (FileConnection)Connector.open("file:///store/home/user/pictures/IMG00004-20100306-2130.jpg");
          
//  FileConnection fconn = (FileConnection)Connector.open(path);
            
System.out.println("Connection establish ");
            if (
fconn.exists())
            {
                
InputStream input fconn.openInputStream();
           
                
ByteArrayOutputStream baos = new ByteArrayOutputStream();
                
int j 0;
                while((
j=input.read())!=-1)
                {
                    
baos.write(j);
                }
                
bytexxx91;xxx93; data baos.toByteArray();
                               
                
EncodedImage image EncodedImage.createEncodedImage(data,0,data.length);
                
image sizeImage(image,360,480);
                
g.drawImage(0,0,300,400,image0,0,0);
              
            }
            else
            {
                
add(new LabelField("Picture  doesn't exist"));
            } 
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Altair 4X
$300.0
Altair 4X pictureMSA ALTAIR 4x Multi Gas Detector NEW
$50.0
MSA ALTAIR 4x Multi Gas Detector NEW pictureALTAIR H2S MSA GAS DETECTOR
$40.0
ALTAIR H2S MSA GAS DETECTOR pictureMSA Safety 10092523 ALTAIR Single Gas Detector Oxygen O2 Low Alarm 19.50% Hig...
$276.74
MSA Safety 10092523 ALTAIR Single Gas Detector Oxygen O2 Low Alarm 19.50% Hig... pictureMSA Safety 10107602 ALTAIR 4X Gas Detector Charcoal LEL O2 CO H2S
$724.99
MSA Safety 10107602 ALTAIR 4X Gas Detector Charcoal LEL O2 CO H2S picture






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