Adding androrm to your project is as simple as 1, 2, 3. The only descission, you have to make right from the start is, whether you want to go with the latest stable release or if you want to check out the latest version in the repository.
Now, after you have decided for one version, the steps are exactly the same. Assuming you work within eclipse to write your android application, first create a new folder called
libs. Right-click your project and choose
New > Folder.
After that, just copy and paste the
androrm.jar file into this folder and add it to the
build path. You simply do this, by right-clicking the
jar and selecting
Build Path > Add to Build Path.
That's it! You're done and can now start defining your models.
Androrm uses the following third-party libraries in order to provide its functionality:
- Apache Commons - Lang (3.1)
After you added the library to your classpath you still have to tell androrm which classes, it should manage. Unfortunately you can't just hand in a package name at this stage. But this support should come in future releases. For now, there are two steps you have to take.
1. Choose a name for your database
By default androrm will create a database called
my_database. If you want to change that name for any reason (this might be handy if you create test databases), you can easily do so.
2. Register your models
The second and also the last step is to tell androrm exactly which classes you want to have managed. You only have to do this once, preferably in your launcher activity.
List<Class<? extends Model>> models = new ArrayList<Class<? extends Model>>(); models.add(FirstModel.class); models.add(SecondModel.class); DatabaseAdapter adapter = DatabaseAdapter.getInstance(getApplicationContext()); adapter.setModels(models);
After these two steps, you are set up and ready to go!