Discussion Board

Results 1 to 2 of 2

Thread: thread problem

  1. #1
    Registered User
    Join Date
    May 2009

    thread problem


    I have a MIDLET Runnable:

     public void run()
                     cont33 = Conn("http://finance.yahoo.com/");
            catch (Exception exc)
    String Cont(String url) throws IOException {
             HttpConnection c = null;
             InputStream is = null;
             StringBuffer str = new StringBuffer();
             try {
                 c = (HttpConnection)Connector.open(url);
                 // Get the ContentType
                 String type = c.getType();
                 // Getting the InputStream will open the connection
                 // and read the HTTP headers. They are stored until
                 // requested.
                 is = c.openInputStream();
                 // Get the length and process the data
                 int len = (int)c.getLength();
                 int ch;
                 while ((ch = is.read()) != -1) {
             } finally {
                 if (is != null)
                 if (c != null)
    con22 = "text";
    // Before returning, the resultant String should be parsed to get Exchange Rate
    String val = str.toString();
    return val;

    In MIDLET i start the THREAD:
     Thread topCont = new Thread(this);

    cont33 and con22 are global strings variable.

    The problem is that function Con returns NULL and con22 is not set
    I've tested, and before returns(return val, val is not null.

    What I should do?

    The problem it is in function or thread... Con can't comunicate with exterior..

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    The Capital of INDIA

    Thumbs up Re: thread problem

    You have to do the more work about the Java Programming Naming Convention.


    The method returning the correct value,just you chnage the variable scope,in which you are assigning the string returned by that method.Try to declare the val as global.
    Thanks with Regards,

    R a j - The K e r n e l

    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. S60 5th ed emulator startup failed
    By hony in forum Symbian Tools & SDKs
    Replies: 8
    Last Post: 2009-08-11, 21:12
  2. [moved] can not install application in emulator
    By HAHAPrince in forum Symbian Tools & SDKs
    Replies: 26
    Last Post: 2009-04-02, 20:34
  3. Thread Problem on device
    By luoyingzhou in forum Symbian
    Replies: 8
    Last Post: 2007-04-23, 08:35
  4. Problem with the Nokia 6600, Bluetooth and Monty Thread
    By tenfourty in forum Mobile Java General
    Replies: 15
    Last Post: 2005-09-30, 14:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts