Monday, March 8, 2010

J2ME - MIDlet lifecycle explained

MIDlet is the basic execution unit in J2ME and it is in different states in different point of its execution. When you launch an application, operating system loads it up. There are three basic states of a MIDlet:
  1. PAUSED
  2. DESTOYED
  3. ACTIVE
The names are self explanatory. When the application initially loads, its in the PAUSED state. When application starts execution, it transitions from PAUSED to ACTIVE state but before going to active state, startApp() method of the MIDlet is called which you must implement in your MIDlet class.

There are several instances where you yourself or the operating system will request your MIDlet to be paused for example in an event of an incoming call. When your application is requested to be paused, it goes from ACTIVE to PAUSED state and before it gets pasued, pauseApp() method is executed. If you want to stop or pause any running threads in your app while it is in paused state, you should write your code in pauseApp() method.

And whenever you exit your application, it will transition from the ACTIVE or PAUSED state to a DESTROYED state. In destroyed state, all resources are de-allocated and the application process is killed. If you want to run some code at the exit time of your applicatin, like closing network connections and storage devices, you should write your code in destroyApp() method of your MIDlet class.

Following diagram gives a clear picture of the MIDlet lifecycle in J2ME applications.




Related Articles:

What is a MIDlet?
How to write your first J2ME app?
Mobile applications - User interfaces
J2ME - User interfaces

29 comments:


  1. Thanks for posting useful information.You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...Really it was an awesome article...very interesting to read..
    please sharing like this information......
    Android training in chennai
    Ios training in chennai

    ReplyDelete
  2. Thanks for posting useful information. Thank you very much for this one.

    iPad Development Houston

    ReplyDelete
  3. The blog was absolutely fantastic! which can be in helpful for successful mobile application development. Mobile application development

    ReplyDelete
  4. Try this Vender app! Vender is a mobile application that lets you manage your leads and tasks in 1 app. Communicate and Log Your Activities, get Things Done, backup and Sync All Your Devices and decide Better with Visual Reports

    ReplyDelete
  5. Appers – We have the super iOS Development team in world! Offering iPhone App Development Service in Melbourne & Brisbane.

    iPhone App Developers

    ReplyDelete
  6. Much obliged to you such a great amount for sharing. Continue refreshing your blog. It will extremely helpful Mobile App Development in Delhi
    to the numerous clients Mobile App Development in Delhi

    ReplyDelete
  7. This content creates a new hope and inspiration with in me. Thanks for sharing article like this.
    Online Marketing Services
    SEO Specialist in Bangalore
    seo plans india

    ReplyDelete
  8. Nice blog and absolutely outstanding. You can do something much better but i still say this perfect.Keep trying for the best. Hire Blackberry Application Developer

    ReplyDelete
  9. Nice blog! Very interesting and informative post….Thank's for sharing such a nice information….Keep it up!!.
    Sdaemon Infotech Pvt Ltd
    Top Web Development Company in Pune
    Web Services Provider in Pune

    ReplyDelete
  10. I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision. I appreciate your work Please Keep Sharing more update mobile application development.

    ReplyDelete
  11. Thanks for sharing great information mobile application development
    MOBILE APPLICATION DEVELOPMENT

    ReplyDelete
  12. I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing.. Believe me I did wrote an post about tutorials for beginners with reference of your blog. 
    rpa training in bangalore
    best rpa training in bangalore
    RPA training in bangalore
    rpa course in bangalore
    rpa training in chennai
    rpa online training

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.

    AWS Training in Bangalore | Best AWS Amazon Web Services…
    Amazon Web Services (AWS) Training in Pune India
    AWS Training | AWS Training and Certification | AWS online training
    AWS Training in Bangalore cost| Aws training in Bangalore with placements

    ReplyDelete
  15. I have visited this blog first time and i got a lot of informative data from here which is quiet helpful for me indeed. 
    AWS Training in pune
    AWS Online Training

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. Nice post, very useful blogs with very useful information, thank you for sharing this post android app development India

    ReplyDelete
  18. Wondering Articles!It contains a Highly Informative content and it is very helpful to exploring a Knowledge's. Thanks for all your Efforts and Keep sharing

    python training in chennai | python training in annanagar | python training in omr | python training in porur | python training in tambaram | python training in velachery

    ReplyDelete
  19. BetMGM Casino Review and Ratings by State
    BetMGM is a licensed online gaming operator 예스 벳 based out of the Isle 슬롯 나라 of Man. It is licensed 토토 꽁머니 by the Kahnawake Gaming Commission 온라인 바카라 게임 and the Kahnawake Gaming Casino Promotion: BetMGM 토토 사이트 추천 Casino: 400% up to $200Slot Type: Video Rating: 3 · ‎Review by Oklahoma Casinos

    ReplyDelete