0

I am developing an application in Blackberry. I have to write a code or a method that runs only once. The method does an action on creating the database. Something similar to Oncreate method in Android. Help of any sort is appreciated.

A Y.

varunrao321
  • 925
  • 2
  • 10
  • 18

2 Answers2

2

Create a singleton class and call the method from singleton class private constructor, or maintain a global flag and check that flag on method call.

There are many other ways but calling of a method is on you, and you can do any way for this.

Animesh Sinha
  • 1,045
  • 9
  • 16
  • Thanks for your reply Anieeh. I had that idea of using a global flag in mind, but I am searching for a better fix. – varunrao321 Apr 30 '12 at 11:51
0

If you want to run that code in single time of application life then,

use persistent store and add one flag, change the flag value after successfully running that code .

Both BlackBerry and Android provide the Persistent storage.

Vivek Kumar Srivastava
  • 2,158
  • 1
  • 16
  • 23