BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 01-28-2010, 10:41 PM   #1 (permalink)
New Member
 
Join Date: Aug 2009
Model: 8800
PIN: N/A
Carrier: BB
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up Problem with HttpConnection read png image (server 64bit)

Please Login to Remove!

Code:
                   String url = "star.png" 
                   // place server 64bit, star.png(128,128)
                   HttpConnection str = (HttpConnection) Connector.open(url);
                   byte[] baResult = null;
                   input = str.openInputStream();
                   DataBuffer db = new DataBuffer();
                   int len = 0;
                   byte[] baChunk = new byte[1024];
                   int size = 0;
                   while ( -1 != (len = input.read(baChunk)) )
                   {
                        db.write(baChunk, 0, len);
                        size += len;
                  }
                  baResult = db.toArray();
                  mapimages = Bitmap.createBitmapFromBytes(baResult,0,size,1);
....

public void paint(Graphics g)
{
    g.drawBitmap(0,0,128,128,mapimages,0,0);
}
I test on simulator + MDS is OK
but on real device image is not display

When I place star.png file on server 32 bit is OK, image is display.

please help me?
Offline  
Old 01-29-2010, 11:18 AM   #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

Probably an HTTP connection issue.

Simulator + MDS emulates a BES environment. Is the test device on BES?

If not, then you need to provide connection parameters to your URL, specifiying how you are to connect.
Offline  
Old 01-31-2010, 08:10 PM   #3 (permalink)
New Member
 
Join Date: Aug 2009
Model: 8800
PIN: N/A
Carrier: BB
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

My ConnectionString is below:
Code:
    public String getConnectionString()
    {
    
        String st = "";
        if ( ( RadioInfo.getActiveWAFs() & RadioInfo.WAF_WLAN ) != 0 )
        {
            if(CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_CARRIER,RadioInfo.WAF_WLAN, false))
                st = ";deviceside=true;interface=wifi";
        }
        else
        {
            //A carrier is providing us with the data service
            if(RadioInfo.getCurrentNetworkName() == null) // not wifi
                return st;
            if ((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_CARRIER) == CoverageInfo.COVERAGE_CARRIER)
            {
                    // blackberry internet service
                ServiceRecord rec = getBIBSRecord();
                if (rec == null)//couldn't find the right record
                            //st = ";deviceside=true";// let the phone try to do the work
                            st = "";// let the phone try to do the work
                    else//found the record, get the id
                            st = ";deviceside=false;connectionUID=" + rec.getUid()
                                        + ";ConnectionType=mds-public";
            }
            else if ((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS)
                st = ";deviceside=false";// use the clients blackberry enterprise server
            else
                st = "";
        }
        return st;
    }

url = "h t tp//abc.com/star.png" + getConnectionString();
Offline  
Old 02-01-2010, 07:22 AM   #4 (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

In your first code snippet, I don't see where you are checking the HTTP response code. You could be successfully reaching the server but getting an error code, like 401 or 500.

Also, do you know which of the connections you are using in this failure case?
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





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