Today, I have a problem with the HTTP request

Well, this time, I try to get an image .png from a URL. To get this I do the following:

try{   if (CoverageInfo.isOutOfCoverage()){      setError("No hay covertura suficiente de la red");        errorFlag = true; } else{     c = (HttpConnection)Connector.open(url);      is = c.openDataInputStream();     for(int j=0;j

My problem is the second 'try' returns: "java.lang.illegalArgumentException". I don't really know much on HTTP conections, so I don't know that I have a lot of wrong code

in other words, I'm moving to the java language this short code on the C++ language:

WebRequest request = System.Net.WebRequest.Create(url);HttpWebResponse response = (HttpWebResponse)request.GetResponse();Stream datos = response.GetResponseStream();Imagen = new Bitmap(datos);pb1.Image = Imagen;datos.Close();response.Close();

can someone help me?

Thank you RexDoug and peter_strange,

in the book "java J2ME a tope"-unfortunately or fortunately (for me), it is in Spanish - explain everything about HTTP request and how to interpret correctly the answer. Finally with the following code, I solved my problem:

try{
    //ask if i have coverage
    if (CoverageInfo.isOutOfCoverage()){
        setError("No hay covertura suficiente de la red");
        errorFlag = true;
    }
    else{
        //create connection
        c = (HttpConnection)Connector.open(url);
        c.setRequestMethod(HttpConnection.GET);
        is = c.openInputStream();

        //process response
        if(c.getResponseCode()==HttpConnection.HTTP_OK){
            size = (int)c.getLength();
            if(size != -1){
                data = new byte[size];
                is.read(data, 0, data.length);
                imagen = Bitmap.createBitmapFromBytes(data, 0, -1, 1);
            }
            else{
                ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
                int stream;
                while((stream=is.read())!=-1){
                    byteArray.write(stream);
                }
                data = new byte[byteArray.size()];
                data = byteArray.toByteArray();
                byteArray.close();
                imagen = Bitmap.createBitmapFromBytes(data, 0, -1, 1);
            }
        }
        //close connections
        c.close();
        is.close();
    }
}

This code is similar to the example of rexdoug.

Tags: BlackBerry Developers

Similar Questions

  • I have a problem with the content of spam. Somewhere in the Fox appeared script that's choking me audio spam. Every 30 minutes he's playing an audio clip that is malicious.

    Hello.
    I have a problem with the content of spam. Somewhere in the Fox appeared script that's choking me audio spam. Every 30 minutes he's playing an audio clip that is malicious. I can't find the settings as it eliminated. Now, I don't have any plug-ins and Add-ons strange that were not initially in the Fox, but the problem is there.
    I use the Fox years. The problem, he had 1.5 months after Fox cleaning. If the problem can't win, I'll be forced to give up the browser, and I wouldn't.

    Could test you mode without failure of Firefox? It is a standard diagnostic tool to disable some advanced features of Firefox and extensions. More info: questions to troubleshoot Firefox in Safe Mode.

    Does not work if Firefox: Hold down the SHIFT key when you start Firefox.

    If Firefox is running: You can restart Firefox in Mode safe mode using either:

    • button "3-bar" menu > "?" button > restart with disabled modules
    • Help menu > restart with disabled modules

    and OK reboot.

    Two scenarios: A small dialog box should appear. Click on 'Start mode safe' (not update).

    Any improvement?

    If the problem persists in Mode without failure, could reinstall you Firefox in this way:

    Clean reinstall it

    We use this name, but it isn't about deleting your settings, this is to ensure that the program, files are clean (not incompatible, corrupt or exotic code files). As described below, this process does not disrupt your existing settings. Don't uninstall NOT Firefox, that does not need.

    (1) download a fresh Installer for Firefox 38.0.5 of https://www.mozilla.org/firefox/all/ in an ideal location. (Scroll down your preferred language).

    (2) close Firefox (if applicable).

    (3) to rename the program folder, either:

    (Windows 64-bit folder names)

    C:\Program Files (x86)\Mozilla Firefox
    

    TO

    C:\Program Files (x86)\OldFirefox
    

    (Windows 32-bit folder names)

    C:\Program Files\Mozilla Firefox
    

    TO

    C:\Program Files\OldFirefox
    

    (4) run the installer you downloaded in the #1. It should automatically connect to your existing settings.

    Any improvement?

    Note: Some plugins can only exist in this OldFirefox file. If it is missing something essential, present in these files:

    • \OldFirefox\Plugins
    • \OldFirefox\browser\plugins
  • Hello! The new version of Firefox, I have a problem with the opening of the site VKontakte. The browser displays the following error message: "Firefox has determined that s.

    Hello!
    The new version of Firefox, I have a problem with the opening of the site VKontakte. The browser displays the following error message: "Firefox has determined that the server redirects the request for this address in a way that it will never end." How to solve this problem? Please excuse me for my English.
    Sincerely, Vsevolod.

    This can be caused by corrupted cookies or cookies that are not sent or otherwise blocked.

    Clear the cache and cookies from sites that cause problems.

    "Clear the Cache":

    • Tools > Options > advanced > network > content caching Web: 'clear now '.

    'Delete Cookies' sites causing problems:

    • Tools > Options > privacy > Cookies: "show the Cookies".

    See also:

  • I have a problem with the HP Deskjet2545 do not print on the computer.

    Printer does not print. Computer says "printer error". Convenience store said that the problem is resolved. The printer is 'ready' doesnot even impression. What is the solution?

    Original title: hpDeskjet2545.

    Hi Matt,

    Thanks for posting your query in the Microsoft Community.

    Printers to print documents, photos, cards and calendars. You have a problem with the printer doesn't work is not on the computer. It can be difficult when something that is important to you does not work as expected. It's pretty simple and we're here to help you solve the problem. We work as a team and get this sorted out.

    Please answer these questions-

    (1) what is the exact error message?

    (2) have you tried the troubleshooting steps?

    (3) what is the version of Windows installed on the computer?

    (4) have you made changes on the computer before the show?

    I would like more information about the issue.

    Note: assuming that you are running Windows 7, I would like to suggest some troubleshooting steps.

    Method 1-

    I would have you look at the article-

    Why can I not print?

    http://Windows.Microsoft.com/en-us/Windows7/why-cant-I-print

    Solve printer problems

    http://Windows.Microsoft.com/en-us/Windows/printer-problems-in-Windows-help#fix-printer-problems=Windows-7&V1H=win8tab1&V2H=win7tab1&V3H=winvistatab1&v4h=winxptab1

    Method 2-

    I wish that you uninstall and reinstall the printer.

    See the article-

    Install a printer

    http://Windows.Microsoft.com/en-us/Windows7/install-a-printer

    Method 3-

    I would have you go through the troubleshooting proposed by HP guide.

    Check out the link-

    http://h10025.www1.HP.com/ewfrf/wc/documentSubCategory?tmp_task=solveCategory&LC=en&DLC=en&cc=us&product=3571292

    Let us know if you need assistance regarding the issue. We will be happy to help you. We at Microsoft, strive for excellence and provide our customers with the best support.

    Thank you.

  • I just did a check of norton power Eraser which revealed that I have a problem with the file ntsd.exe.

    original title: problem with file ntsd.exe

    I just did a check of norton power Eraser which revealed that I have a problem with the file ntsd.exe. Does anyone have suggestions about what to do to fix it? Thank you very much.

    Hi JohnABuckley,

    • Are you facing any problem on the computer?

    Ntsd.exe is a process belonging to the Microsoft symbolic debugger that lets you debug applications in user mode.

    As the link below, it says that there is a risk that Norton Power Eraser can select some legitimate programs for removal. You should carefully review the analysis results page before deleting the files. I suggest that you don't delete the file unless you are facing problems with the computer.

    https://www-secure.Symantec.com/Norton-support/JSP/help-solutions.jsp?LG=English&CT=us&docid=20100824120155EN&product=home&version=1&PVID=f-home

  • I have a problem with the drag (cursor snap) video and audio stuttering!

    I have an emachine windows vista home edition and have caused problems with the drag (cursor snap) video and audio stuttering.  my hardware configuration includes an HP printer and a video camera from Microsoft with pregnant beyond the keyboard, monitor, and system speakers routine.  Are there updates or the settings that I can apply to correct this problem?

    http://www.eMachines.com/support/drivers.html

    The latest drivers/software for your machine come directly from eMachines.

    Click the link above for them.

    See you soon.

    Mick Murphy - Microsoft partner

  • I have a problem with the cursor on the computer.

    Original title: How can I stop this? When I click on a window to make it active, he admits that as a real click click and move the cursor on the page. Windows 7 pro

    Windows 7 pro 6.1

    I do web development on several screens with multiple applications open at the same time.  When I want to use a program that is on my second monitor I click it to make it active.  This click has also acts as a true clicks and moves the cursor on the page.  This can be very annoying because whenever I want to spend the programs I mouse over a sidebar of this application or try to click exactly where my cursor is in the document.

    Looks like a trivial question, but through the course of a day it gets very boring very quickly.  I don't remember that it works this way in older versions of windows, and I hope that there is a way to fix it.  What I would like is the first click on an app just make active in order to quickly click the apllication anywhere and start typing there where I left.

    Hi Vanamp,

    Thanks for posting your question in the Microsoft Community forums.

    I see from the description of the problem, you have a problem with the click of the mouse to activate a window.

    I imagine the inconvenience that you are experiencing. We are here to help and guide you in the right direction.

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

    This problem occurs only with a particular application?

    This problem can occur if the mouse settings are poorly positioned.

    I suggest you try the procedure described in the article and see if it helps.

    Change the settings of the mouse
    http://Windows.Microsoft.com/is-is/Windows7/change-mouse-settings

    Check out the link for more information.

    Make the mouse easier to use
    http://Windows.Microsoft.com/en-in/Windows7/make-the-mouse-easier-to-use

    Let us know the status of the issue after you perform the troubleshooting steps. If you need help or information about the issue with the mouse settings, I'll be happy to help you. We, at tender Microsoft to excellence.

  • I have a problem with the DVD drive not detected on Windows 7.

    I built a new PC (I've built a few of them).  This time is not considered my ASUS BD player with Windows 7 DVD burner.  It is not in either Device Manager just do not at all recognized.  The BIOS for the ASUS P9X79 of luxury see the SATA drive without problem.  Sometimes after restarting the BD Player looks and functions perfectly, but when the computer goes to sleep or shuts down is usually not there when it is restarted.  Please help me solve this problem :-)

    Original title: optical drive not recognized...

    Hello

    Please contact the Microsoft Community.

    You have a problem with the driver DVD being missing on the computer. It can be difficult when something that is important to you does not work as expected. It's pretty simple and we're here to help you solve the problem. We work as a team and get this sorted out.

    Please answer these questions-

    (1) that you get an error message or error code?

    (2) did you have performed the steps in troubleshooting?

    (3) have you made changes on the computer before the show?

    I would like more information about the issue.

    Method 1-

    I wish that you are running the fixit-

    Hardware devices do not work or are not detected in Windows

    http://support.Microsoft.com/mats/hardware_device_problems/en-us

    Method 2-

    Note: Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs.
    Back up the registry - http://windows.microsoft.com/en-US/windows7/Back-up-the-registry

    I would have you look at the article-

    Your CD or DVD drive is missing or is not recognized by Windows or other programs

    http://support.Microsoft.com/kb/982116#top

    Let us know if you have other questions about Windows in the future. We will be happy to help you. We at Microsoft, strive for excellence and provide our customers with the best support.

    Thank you.

  • I have a problem with the Narrator, repeating words and phrases.

    original title: NARRATOR in WIN7 SUPPORT

    I use windows7.  The annoying Narrator sometimes voices repeat words and phrases.  I also need help, change of voice and using Narrator to read aloud my text book I downloaded.  It is in PDF format.

    Original title: Narrator sometimes repeat words and phrases

    Hello

    Thanks for posting your query in the Microsoft Community.

    You have a problem with the Narrator, repeat words and phrases. It can be difficult when something that is important to you does not work as expected. It's pretty simple and we're here to help you solve the problem. We work as a team and get this sorted out.

    Please answer these questions-

    (1) exactly where you run the Narrator?

    (2) the Narrator extends from a particular document?

    (3) have you made changes on the computer before the show?

    I would like more information about the issue.

    Method-

    I wish that return you the items for assistance-

    Narrator doesn't read what I expect him

    http://Windows.Microsoft.com/en-us/Windows7/Narrator-doesn

    Hear text read aloud with Narrator

    http://Windows.Microsoft.com/en-us/Windows7/hear-text-read-aloud-with-Narrator

    Let us know if you need assistance regarding the issue. We will be happy to help you. We at Microsoft, strive for excellence and provide our customers with the best support.

    Thank you.

  • I have a problem with the payment: (why charge me 44,99 EUR (cost 61.99 euros) then block system and I can't use the programs :(

    I have a problem with the payment why charge me 44,99 EUR (cost 61.99 euros) then block system and I can't use programs

    Please click Accounts & billing link here https://helpx.adobe.com/contact.html to have a conversation with our billing support team.

    Thank you

    Stéphane

  • I have a problem with the installation of ADOBE ILLUSTRATOR using creative cloud. It gives me:

    I have a problem with the installation of ADOBE ILLUSTRATOR using creative cloud. It gives me:

    Exit code: 117

    -------------------------------------- Summary --------------------------------------

    -fatal error 2, 0 error (s), 0 warning (s)

    FATAL: Fatal Error ' 117' occurred in download

    FATAL: An error has occurred in the download package (name: AdobeIllustrator19-Core Version: 19.2.0.111). Error code: '117'

    -------------------------------------------------------------------------------------

    N ° 1)

    Click on the below link, Sign In and open Photoshop Elements download link.

    Do not close the page, just keep it open.

    https://www.Adobe.com/cfusion/TDRC/index.cfm?product=photoshop_elements

    Note: * If we do not keep the page of items in Photoshop, we will have access denied error message when file downloading install direct.

    Then click on the link below and download the installer directly mentioned in step 2.

    Step 2)


    http://prodesigntools.com/trials3/AdobeProducts/ILST/19/Win64/Illustrator_19_LS20_win64.7z

    Step 3)

    Unzip the installer using 7zip or winrar and then install the product.

  • I have Photoshop CS6 and Lightroom 5.7. They are currently installed on a PC with Windows 8.1 Professional 32-bit and 4 GB of RAM. I want to move to a PC with Windows 8.1 Professional 64 bit and 32 GB of memory, because I have a problem with the large

    I have Photoshop CS6 and Lightroom 5.7. They are currently installed on a PC with Windows 8.1 Professional 32-bit and 4 GB of RAM. I want to move to a PC with Windows 8.1 Professional 64 bit and 32 GB of memory, because I have a problem with the large RAW from a Canon 5 Ds R. What should I do?

    You install exactly in the same way you did the 1st time... Put your disc in the drive, and enter your serial number when asked

    Download & install instructions https://forums.adobe.com/thread/2003339 can help

    -includes a link to access a page to download the Adobe programs if you do not have a disk or drive

    Also go to https://forums.adobe.com/community/creative_cloud/creative_cloud_faq

  • Since I load Acrobat Reader DC, when I try to save the document, word to PDF, the pdf file pages are cut on the width. I use Microsoft Office Word 2007 and I have no problem with the previous version of Adobe Reader. Should what settings I adjust?

    Since I load Acrobat Reader DC, when I try to save the document, word to PDF, the pdf file pages are cut on the width. I use Microsoft Office Word 2007 and I have no problem with the previous version of Adobe Reader. Should what settings I adjust?

    Hi judithl34724699,

    If you want to convert Word files to PDF with the Adobe Reader application then it is possible with the service Pack of PDF. Try to use the service on the web: https://cloud.acrobat.com/convertpdf

    Also try to use a different file type.

    Thank you

    Abhishek

  • Unable to contact the Service Adobe, I have a problem with the number.

    Hello

    I would like to have more information about the Adobe domain controller. My intention is to buy the product and use it in my office, we are a small company (4 PCs).

    If I am wrong, I have to take the standard networks for Business Plan, but I can't organize any request for payment for more information, because I don't have a problem with the number I'm supposed to call.

    Y at - it another way to know if this software is very suitable for me and my business and most of all the how much it will cost.

    Thank you for your attention.

    Good day!

    I look forward to hear from you.

    Best,

    Augusto

    Hi Avgvstvs67,

    Please see this link: https://acrobat.adobe.com/in/en/pricing/business-pricing.html

    Kind regards

    Rahul

  • Hello I am a student and I have a problem with the tool Selection (V). When I opened the file AI CC with CS6 selection tool doesn't allow me to change the selection. What can I do? (I have reinstall AI CC and the problem persists)

    Hello I am a student and I have a problem with the tool Selection (V). When I opened the file AI CC with CS6 selection tool doesn't allow me to change the selection. What can I do? (I have reinstall AI CC and the problem persists)

    Ivan,

    If it's on the rectangular objects, you may have encountered the bug Rectangle Live which is limited to the MAC versions from 10.7 and 10.8, but not of 10.9 (Mavericks) or 10.10 (Yosemite). If all goes well, the bug will be fixed soon.

    Thus, a switch for the Mavericks or Yosemite with a reinstall might be the way to solve it here and now.

    To get around it, in each case, it is possible to develop direct Rectangles to get the normal old shaped rectangles or Pathfinder > unit, or use the scale tool or the free transform tool.

    A more permanent way round that is to create normal old shaped rectangles, after running the free script created by Pawel, see this thread with download link:

    https://forums.Adobe.com/thread/1587587

Maybe you are looking for

  • Drivers for Satellite A100 PSAARA necessary

    Someone wants to download driver for Toshiba A100 PSAARA disk.I lost it and now its really need! Thank you!

  • Printing to a printer from a domain from a workgroup printer

    I have a computer that is located on a working group. We want to be able to print to a printer on the field. I installed the printer as a network printer and entered the username admin and the password and it worked. However, as soon as I restart the

  • How to get the position of a ring in a tree control?

    Okay, this is probably a stupid question, but how can we get the position of a ring within a tree control?  I have a tree with two columns, with rings in the second column.  I can set the position using SetTreeCellRingValueFromIndex(), but how do you

  • How do I check/set myself as admin on my laptop?

    I am looking to clear some unused programs from my C: drive because it's pretty complete. Many of them have not been consulted used over the years, but will not uninstall that I need permission to "administrator."As I am the only user of this laptop,

  • External hard drive for use with original hard drive?

    Help I am trying to add an external hard drive to my current computer.  I got the hard drive connected, but I want windows vista to use it as if it were a part of the main hard drive.  Sorry kinda new to this so forgive me if this is a stupid questio