-4

Possible Duplicate:
J2me detecting first start of application

I'm developing a J2ME application and I want to know if it is the first time to run the application in the device to be able to show welcome message to user and else the user will be taken to the main screen directly

How to make so?

Community
  • 1
  • 1
Amira Elsayed Ismail
  • 9,216
  • 30
  • 92
  • 175
  • 2
    This question was asked by another user and answered yesterday Why woun't you learn to search? http://stackoverflow.com/questions/10480413/j2me-detecting-first-start-of-application – Yaroslav Mytkalyk May 08 '12 at 14:51

2 Answers2

0

A simple solution...

When the user clicks the button to close the welcome message, write out a file to disk. When you start the application the next time, check to see if the file exists - if it does, the user has already seen the welcome screen. If the file doesn't exist, the welcome screen hasn't been shown (ie first run of the application)

Rather than asking a question like this, you should post some ideas, or some code, to show us that you've at least tried to do this yourself first.

wattostudios
  • 8,666
  • 13
  • 43
  • 57
  • I would not agree that creating a file on a mobile device is a good solution. It will mess up the file system, and the file should'nt be deleted by a user accidently, and the file should be deleted by user after the application was removed. The best solution for a mobile device is creating a record store. – Yaroslav Mytkalyk May 08 '12 at 15:10
  • 1
    If we're only talking about a small file that indicates whether the user has seen the welcome screen or not, I think its probably a suitable solution. If the user deletes the file accidentally, they'll see the welcome screen again - no big deal. The file itself would only be a few bytes in size, so it wouldn't consume space, but yes it would leave the filesystem a little messy. However, the user should program the code to write the file to a location suitable for its purpose, such as into a 'settings' or 'config' directory. – wattostudios May 09 '12 at 03:04
-2

When you first run an app, you can display the welcome message & then create any normal file like any .txt. Make your code such that @ startup each time it will see if that file is present or not. If present, go to main screen n if not, show welcome message & create the file.

Edit: Agreed with Doctoror Drive. Much richer way of storing data is with Record Store. Check this.

Kapil Jituri
  • 1,241
  • 14
  • 25
  • 1
    I would not agree that creating a file on a mobile device is a good solution. It will mess up the file system, and the file should'nt be deleted by a user accidently, and the file should be deleted by user after the application was removed. The best solution for a mobile device is creating a record store. – Yaroslav Mytkalyk May 08 '12 at 14:56