Skip to content
pyricau edited this page Aug 17, 2012 · 1 revision

Since AndroidAnnotations 2.7

Thanks to Johan Poirier, you may inject your OrmLite DAOs with the @OrmLiteDao annotation.

The @OrmLiteDao has two mandatory attributes :

  • helper should hold the class of your database helper (which should extend android.database.sqlite.SQLiteOpenHelper)
  • model should point to the model class that the DAO relates to. It should match the type of the first generic parameter of your Dao

Usage:

@EActivity
public class MyActivity extends Activity {

	// UserDao is a Dao<User, Long>
	@OrmLiteDao(helper = DatabaseHelper.class, model = User.class)
	UserDao userDao;

	@OrmLiteDao(helper = DatabaseHelper.class, model = Car.class)
	Dao<Car, Long> carDao;

}

Using AndroidAnnotations

Questions?

Enjoying AndroidAnnotations

Improving AndroidAnnotations

Clone this wiki locally