×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Problem with Thread

    Hi,
    I have an app which saves data on the rms on a particular time basis. This is handled by a Timer/TimerTask combo and is scheduled to execute every 5 secs...
    The idea is to save some data in case the feared "red button" is accidentally pushed.
    It al seems to work but now I encountered a problem, if the "red button" is pressed (in the emulator) the midlet is shut down but the wtk emulator still keeps running (just like a real phone, and my testbed a Nokia N95) I noticed the thread keeps running (and thus keeps writing to the RMS). I know this because I let it write some text to the output stream.
    I am wondering how this is possible ? And how do I stop it ?
    The second problem is that this thread also updates a variable in my main Midlet.
    Obviously my main midlet object is destroyed once the red button is pressed. Then I restart my midlet, and the rms-saving Timer object still has the old reference to the old midlet, also the midlet creates a new rms-saving Timer thread because it doesnt recognize the already existing (out of his midletsuite) thread, this isnt a object created by the midlet at that moment in time so why should it recognize it ?

    Does this sound familiar to anyone or does anyone have some tips ? I tried it on a real device also but having no output stream I actuallly dont know how it behave,s I do know that after restarting the midlet the variable in the midlet will NOT be updated anymore...

  2. #2
    Registered User
    Join Date
    Sep 2007
    Location
    Bangalore
    Posts
    868

    Re: Problem with Thread

    Hi,
    As of my knowledge if you press the red button In S60 Devise the Midlet Will not close it will go to back ground and it will be running.

    Hope it will helps you

  3. #3
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: Problem with Thread

    Hi Tiger!

    I have not an answer to your problem, but a possible workaround: what about using the MIDlet destroyApp() method to manually stop your Timer?

    Pit

  4. #4
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Problem with Thread

    hey thx for the fast replies,
    I was just trying with the destroyApp() method :P

    gonna debug in a jiffy

    and the red button doesnt bring it in the background but actually really closes down the app...

  5. #5
    Nokia Developer Expert
    Join Date
    Jun 2005
    Posts
    923

    Re: Problem with Thread

    Red button WILL close the MIDlet, not push it to the background. This behavior is not customizable. When it does its thing, destroyApp() will be called, and that's the place for stopping the thread which is writing to RMS.

    Daniel

  6. #6
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Problem with Thread

    well,
    it seems it was mostly an emulator problem... the wtk emulator doesnt actually close off all threads of a midlet when te red button is pushed...

Similar Threads

  1. Need Help with thread
    By gigglie in forum Symbian
    Replies: 0
    Last Post: 2008-06-20, 06:39
  2. Multi Thread problem
    By Segev in forum Symbian
    Replies: 4
    Last Post: 2007-05-03, 19:38
  3. Thread Problem on device
    By luoyingzhou in forum Symbian
    Replies: 8
    Last Post: 2007-04-23, 08:35
  4. Problem Accessing Database within a Thread function
    By MohammadHendy in forum Symbian
    Replies: 0
    Last Post: 2005-12-15, 14:18
  5. 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
  •  
×