Error on image from the server and display streaming

Hi all

Im trying to read an Image that origin of the server and displays on a screen

Here's the code I'm using to broadcast the image.

It is streaming on my Simulator as well as on some devices.

But on some devices, it's not streaming and throw an exception.

public UrlToEncodedImage(String url)
{
HttpConnection connection = null;
InputStream inputStream = null;
byte[] dataArray = null;

try
{
connection = (HttpConnection) Connector.open(url+getConnectionString(), Connector.READ, true);
inputStream = connection.openInputStream();
byte[] responseData = new byte[10000];
int length = 0;
StringBuffer rawResponse = new StringBuffer();
while (-1 != (length = inputStream.read(responseData)))
{
rawResponse.append(new String(responseData, 0, length));
}
int responseCode = connection.getResponseCode();
if (responseCode != HttpConnection.HTTP_OK)
{
throw new IOException("HTTP response code: "+ responseCode);
} 

final String result = rawResponse.toString();
dataArray = result.getBytes();
}
catch (final Exception ex)
{ }

finally
{
try
{
inputStream.close();
inputStream = null;
connection.close();
connection = null;
}
catch(Exception e){}
} 

bitmap = EncodedImage.createEncodedImage(dataArray, 0,dataArray.length);
// this will scale your image acc. to your height and width of bitmapfield

int multH;
int multW;
int currHeight = bitmap.getHeight();
int currWidth = bitmap.getWidth();
if(currHeight>350&&currWidth>350){
    bitmap=scaleToFactor(bitmap,currWidth,currHeight,Display.getWidth()-20,250);
}

}
public EncodedImage getEncodedImage()
{
return bitmap;
}
public  EncodedImage scaleToFactor(EncodedImage encoded, int curWidth, int curHeight, int newWidth,
        int newHeight)
{
     int numerator_width = Fixed32.toFP(curWidth);
     int denominator_width = Fixed32.toFP(newWidth);
     int scale_width = Fixed32.div(numerator_width, denominator_width);

     int numerator_height = Fixed32.toFP(curHeight);
     int denominator_height = Fixed32.toFP(newHeight);
     int scale_height = Fixed32.div(numerator_height, denominator_height);

     return encoded.scaleImage32(scale_width, scale_height);
}
private static String getConnectionString()
{
    String connectionString = null;
    if(DeviceInfo.isSimulator())
    {
            if(UrlToEncodedImage.USE_MDS_IN_SIMULATOR)
            {
                   connectionString = ";deviceside=false";
            }
            else
            {
                   connectionString = ";deviceside=true";
            }
    }
    else if(WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED)
    {
       connectionString = ";interface=wifi";
    }

    else if((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_DIRECT) == CoverageInfo.COVERAGE_DIRECT)
    {
        String carrierUid = getCarrierBIBSUid();
        if(carrierUid == null)
        {
         connectionString = ";deviceside=true";
        }
        else
        {
           connectionString = ";deviceside=false;connectionUID="+carrierUid + ";ConnectionType=";
        }
    }                

   else if((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS)
    {
      connectionString = ";deviceside=false";
    }

   else if(CoverageInfo.getCoverageStatus() == CoverageInfo.COVERAGE_NONE)
    {}
    else
    { connectionString = ";deviceside=true";} 

    return connectionString;
}
private static String getCarrierBIBSUid()
{
    ServiceRecord[] records = ServiceBook.getSB().getRecords();
    int currentRecord;

    for(currentRecord = 0; currentRecord < records.length; currentRecord++)         {             if(records[currentRecord].getCid().toLowerCase().equals("ippp"))             {                 if(records[currentRecord].getName().toLowerCase().indexOf("bibs") >= 0)
            {
                return records[currentRecord].getUid();
            }
        }
    }

    return null;
}

The underlined part of the code is where the uid is sent as public _.

Please, look in the code and let me know where the error is, or is there a better way to disseminate the image.

In the hope that you hear.

Thank you & best regards

Krishnan

Hello

I found the error.

It's in the URL sent by the server.

The URL consisted of http://google.com

But the format required to retrieve the image on several device would be http://www.google.com.

Thanks for anyone who tried to help him.

Krishnan.

Tags: BlackBerry Developers

Similar Questions

  • How do I download an image from a server and store it in EncodeImage

    How to download an image from a server and store it in EncodeImage?

    It allows you to create an EncodedImage object. so that you can upload an image from a server, you can use HttpConnection to send a request to your server. Then, your server can return the image file. Since he will cross the stream, you can read and store it in a "byteArray". so the ByteArray, you can generate an EncodedImage by calling the EncodedImage.createIncodedImage (byteArray). now that you already have a coded picture.

  • Cannot transfer images from the camera and cell phone.

    Original title: print printer print

    I have a HP Photosmart C42oo all-in-one printer. It works fine and prints, but I can not all images of my little Kodak camera or my cell phone to my computer. It is as if the connection does not exist and in fact it s use to work perfectly until I get a new computer with windows 8. Can someone please help?

    Hello

    To provide the proper resolution, I would need more information on your side.

    1. what exactly happens when you try to transfer the images from the camera and cell phone?

    2 are the devices found on the computer?

    3. do you receive any error messages? If Yes, what is the exact error message?

    I suggest to use App Photos and to try the steps, click the link:

    Organize your photos
    http://Windows.Microsoft.com/en-in/Windows-8/organize-photos

    Please provide the necessary information to help you further, I'll be happy to help you.

  • I downloaded a few images from the CPD and sent links to complete the download.  How can I get downloads?

    Hello

    It is more a question of support Adobe Stock for a user.

    I downloaded a few images from the CPD and sent an email to do the download.  Since the conversion window Adobe was already open, I didn't cancel the Adobe window.  How can I access the images associated with the links?  I can access is no longer as there is no code.  I didn't know that the images already chosen by download would be unavailable.

    Thank you

    Craig.

    Hi Craig

    I can see your account Adobe Stock 95 unused DPC downloads have been migrated and you have 10 images from your Adobe Stock Plan.

    Is - that so many unused downloads, you expected to migrate?

    Thank you

    Bev

  • Import Images from the PS and LR problem

    Hi all

    Since my last update App, I experienced some problems when you import images from LR into PS

    1. where, in LR, I select 2 or more images of 'open as layers in PS', I get a Pop Up telling me that I need the latest version of Camera Raw... It is up to date according to my account.

    2. once I finished with the photos in PS and save them in LR... the final image is ebb in different areas of the strip of film...  Sometimes it is the first image... sometimes, it's the last image...  I have the set to Capture time.  It slows down my work flow in organizing my photos.   I photograph the real estate and the placement of the final images is crucial.

    All the tips are greatly appreciated.

    Thank you...

    Brian

    This bug has been recognized by Adobe.  Please add your vote me too, and the details of your problem to this bug in the Adobe official feedback forum report: Lightroom: sort by Capture time. Community customer Photoshop family . He will make more Adobe likely to give priority to a solution and inform you immediately when the bug status.

  • Get the data from the file and display it in a dynamic text box

    The purpose of this function is to load and display a specific menu for a restaurant (lunch, dinner, dessert, etc.).

    This script is inside a clip that has the text box and buttons.

    There are 4 buttons that have event listeners that go to a function that determines which button was pushed and then sends a call to loadMenu with a string that has the file.txt.

    In frame 1 of the clip, the variables used in the code are declared as such:

    var newMenuRequest:URLRequest = new URLRequest();
    var newMenuLoad: URLLoader = new URLLoader();
    var loadThisMenu:String = ""; This is the variable of the function buttonclick modifies and defines as the string to send to the loadMenu.

    My error is 1195: any attempted access of inaccessible method with flash .net url: URLRequest of static type

    Any ideas?

    newMenuRequest is an instance of a URLRequest... and it is not a method of url.
    She has a url property.

    I'd be inclined to create a new URLRequest every time. But perhaps this isn't necessary.

    Try changing
    newMenuRequest.url (menuName);
    TO:
    newMenuRequest.url = menuName;

    see if it works.

  • My Thuderbird for mac does not delete messages from the server and can not find the setting in tools to do.

    According to the forum users, you go to tools-> account settings and there should be a box to "leave the message on the server" that I can uncheck, however, I don't see that my Thunderbird program for mac.

    You use the POP or IMAP protocol by e-mail? I guess that IMAP because you do not see the option.

  • How to change the data from the database and displayed in a DG

    Hello, it's me again with a simple question:

    I received the request of SQLi that returns multiple lines.

    In this line, I have for example:

    Reward-> 1

    How, instead of show 1 in the data grid, change this value to 'YES '.

    I followed this thread:

    private void onResultStats(event:ResultEvent):void

    {

    ServerStatsArr = new ArrayCollection (event.result.source);

    for (var i: int = 0; i < ServerStatsArr.length; i ++)

    {

    If (.abonnement ServerStatsArr [i] == 304) {}

    ServerStatsArr [i] .abonnement = 'Premium ';

    } else {}

    . Subscription ServerStatsArr [i] = 'no ';

    }

    If (ServerStatsArr [i] .transparence == 1) {}

    . Transparency ServerStatsArr [i] = 'yes ';

    } else {}

    . Transparency ServerStatsArr [i] = 'no ';

    }

    }

    ServerStatsArr.refresh ();

    }

    Why this method works for the subscription when (.abonnement ServerStatsArr [i] == 304) he displays Premium, but it does NOT work for transparency ?

    I tested (.transparence ServerStatsArr [i] == 1) and (.transparence ServerStatsArr [i] == '1')

    Thank you

    Hi again,

    private void setLabel(item:Object,column:DataGridColumn):String

    {

    Switch (Column.DataField)

    {

    case 'transparency ':

    If (item.transparence is "1")

    return ('yes')

    on the other

    return ('no')

    break;

    case "subscription":

    If (item.abonnement is "304")

    return ("premium")

    on the other

    return ('none')

    break;

    by default:

    Return("");

    }

    }

    and your grid adjustments - add the labelfunction to the following topics
    I hope we get a credit of distinction for this mission...
    David.
  • Remove the snapshot from the server and then send a mail to me when the work is finished.

    Hi all

    Could someone help me with a script that would do this?

    Concerning

    Tyler

    This goes in the direction of what you are looking for?

    $snaps = Get-VM | Get-Snapshot
    Remove-Snapshot -Snapshot $snaps -Confirm:$false
    
    $emailFrom = "[email protected]" $emailTo = "[email protected]" $subject = "All snapshots are removed" $body = $snaps | select VM,Name,Created,SizeMB | ft -AutoSize | Out-String $smtpServer = "smtpserver"
    $smtp = new-object Net.Mail.SmtpClient($smtpServer)
    $smtp.Send($emailFrom, $emailTo, $subject, $body)
    
  • How to send photos by mms from the server?

    Hello

    I am currently working on mms app.what I do is first download the image of the server and then send.

    but there is a string currentLocation (location of the file we want to fix) parameter to MessagePart.

    so I use it directly from server how can I achieve that.

    pls help...

    thankx.

    Hello

    My problem was solved by using

    Bitmap image=imageObj.originalImage[0];
                PNGEncodedImage encodedImage=PNGEncodedImage.encode(image);
                byte[] contents=encodedImage.getData();
    
  • No response from the server when you try to publish the page.

    My site was working fine last night but this morning that it does not load and im getting an error "no response from the server" when I try to publish it.

    www.joshuasisneyphotography.com

    I don't have much experience with that kind of stuff. Please help me. I don't know what I have to do. My internet connection seems to work very well and like I said the site was fine a few hours ago.

    Hello

    Please try to delete the temporary files for Muse and then try to publish the site again.

    Here's a post on the forum related on how to clear temporary files: http://forums.adobe.com/message/5086018#5086018

    Hope this helps you publish the site.

    Rgeards,

    Fox

  • Project files not deleted from the server

    Thank you in advance if you can help.

    Application: Robohelp6/Server6 and earlier versions. Don't know about 7 or 8.
    Output: Webhelp Pro

    Reminder: whenever I delete a topic to the editor and the Publisher a project to our server, this topic htm file is not deleted. I started calling them 'ghost' files because they should be dead and buried. Some users access these files after a direct URL where providing outdated information. They are not normally appear in the results of search of the application but the hyperlinks to their work until the file is deleted.

    I tried different publishing options for their removal. Check to delete the files and republish the entire project. The only way I found to get rid of them is to remove the file from the server manually. Another option is to remove the project from the server, and then republish it.

    Can question: Anyone explain what is happening and if there is anything I can to make sure that they are automatically deleted when publishing.



    Hi Captiv8r,

    Quote:
    Posted by: Captiv8r

    I do not believe that anything it either in the edition of RoboHelp erase files. It is my experience that any file that needs to be deleted from the server must be done manually.

    I think as the responses above in the quote from my question. I guess I was looking for confirmation on what I saw.

    Thank you very much for your help.

  • Loader will load the images from another server, but then we get error on Bitmap operation

    I develop an application that currently uses Loader to get the images to another server.  This should not work now because we are still waiting for the owner of that server to put a crossdomain in place file.  However, it works - sort of .

    Charger can load the images very well, without error.  But then the application has a feature that we are a great duplicate of the image to display in a sidebar, we do this in this way:

    var myBitmap:Bitmap = Bitmap (loader.content);

    and when will we get a Flash player 2122 security error, violation of sandbox.

    So although I hope that all this will fix itself when the crossdomain.xml file is set up, I am confused as to why we get only the sandbox error when we do a bitmap image, and not when we try to initially retrieve the image.

    (By the way: is there a better way to make a "copy" of an image loaded by a loader and change its width and height to display simultaneously in another part of the scene?)  "I have need to change its real dimensions - I just need to change its display width and height).

    Thank you!

    The sandbox allows you to view, not not editing from another server without a cross-domain.

    Therefore, when you try to load up, it loads, it 'read only' and gives you an error when you try to "change" by a new Bitmap out of it.

    This should resolve itself once crossdomain is in place.

    || EDIT |

    I just realized that I have to clarify my statement a bit more.

    When you load images from another server without a crossdomain, it only allows the load for display.  When you try to load data, it will fail.  It is because that data XML, or another type of data is editable by default, and the images are only visible by default.  As a result, the image fails when you try to convert it to an editable form.

  • Image: poster of local disk, download server and display the server file system

    Hello

    I use jdev 11.1.2.4.0...

    The requirement is that users want to upload images to their local drive for the drive on the server and they would like display of server disk images later.

    We do not want to save the images in the database. I'm not sure what should be the solution; However, I intend to...

    1 create a table to keep information from images - image_id, image_location (server drive), image_filename

    2. create a page where users can enter image information and specific file on a local disk name (I think I'll use inputFile component) and provide the Preview button to display an image on the screen before saving. To record data is to save the information in the database and copy an image file on the disk on server (the location for image files is predefined.)

    3. create another page where users can browse the database information and display an image for a selected record getting from the server.

    I need suggestions on...

    1. how to display an image on the page of the local drive?

    2. how to copy a file on a local disk to a server?

    3. how to display an image on the page of the drive on the server?

    Thank you.

    NAT

    See:

    http://tompeez.WordPress.com/2011/11/26/jdev11-1-2-1-0-handling-imagesfiles-in-ADF-part-1/

    http://tompeez.WordPress.com/2011/11/26/jdev11-1-2-1-0-handling-imagesfiles-in-ADF-part-2/

    http://tompeez.WordPress.com/2011/12/16/jdev11-1-2-1-0-handling-imagesfiles-in-ADF-part-3/

    When Timo records the images in the database, you save it in the file system (examples on how to do this Java are available much if you just Google for it). Similar to Timo you then use the tag image to display pictures. The difference is that you can directly add the URL of the database table.

    The advantage of using a database to host images, it's that you're not although dependent on files server structures

    Frank

  • I've implemented all the information for an email from the Charter and then when I click on get mail, it says there is a connection to the server error... Why?

    I've implemented all the information for an email from the Charter and then when I click on get mail, it says there is a connection to the server error... Why?

    Hello ChevyDriver10,

    Thanks for your post.  What email app do you use to receive your mail?

    In the meantime, take a look at the Charter of General electronic installation instructions.

    If you do not currently have an e-mail client, feel free to go on Windows Live Mail.

    See you soon

Maybe you are looking for

  • Lock - contact the former owner - activation mission impossible?

    Hi Apple community! I bought an iphone 5 recently, which is locked (bought cheaply but) activation of the former owner. Of course, the person who sold me the unit doesn't have any info on the phone. BUT! I want to get in touch with the previous perso

  • Synchronization Ox80072ee7 problem

    How can I get rid from which fix a sync problem error # Ox80072ee7?

  • TableLayoutManager how to use?

    Hello I want the data in table Formate I use http://devblog.blackberry.com/2009/10/how-to-use-table-view-layout/ this link to store the data in a tabular format. But I am facing a problem when I add after code. TableLayoutManager colFMgr = new TableL

  • How to check if the blackberry's camera?

    How can I check if the phone has photo via code? Thank you.

  • IP domain name

    Can I set up a router with SSH access without specifying a domain ip? It is default to something? If I don't have, can I just pick any name? Thank you