I'm having trouble in designing my app for Android.
I'm using AndroidAnnotations and greenDAO.
I have an activity which has a GridView. This GridView is populated with Objects retrieved from the database, using greenDAO. When the user click an item, I open other activity, passing the id of the item that was clicked using an intent extra (I tried passing the whole object, using Serializable, but I got an error in greenDAO). This other activity should display a list of objects that are from the first object.
Explaining better:
Object A has a field orders (List) that are a ToMany relation in GreenDao.
The user clicks the Object A and should be redirected to a screen that has this list of Orders.
My idea is to pass the Object A id to the other activity and retrieve it again from the database.
To the view list I'm using the exact code of https://github.com/excilys/androidannotations/wiki/Adapters-and-lists, that consists of:
- ObjectItemView class (extends LinearLayout) annotated with @EViewGroup
- ObjectFinder class (has all the things needed for greenDAO), annotated with @EBean
- ObjectListAdapter (extends BaseAdapter) annotated with @EBean
- ObjectListActivity (extends Activity) annotated with @EActivity
ObjectFinder has a method that returns a list of objects.
ObjectListAdapter injects the ObjectFinder using the @Bean annotation and uses it to populate a list of objects.
ObjectListActivity then injects the ObjectListAdapter and set this adapter to the ObjectList.
This works well if you want to retrieve all the entities of the database, using a findAll method.
The problem is that a need a particular entity and @EBean classes do not allow to pass any parameter in the builder, so I can't 'reach' the finder or the builder to tell it what entity to retrieve.
What should I do?