-
Notifications
You must be signed in to change notification settings - Fork 2
ImportantEntityFields
Scala-Android-Crud uses Triangle for the EntityType fields.
Each field that needs to be persisted in the database must support getting its value from a Cursor and setting it into a ContentValues. There are many types already supported that begin with “persisted” (in CursorField) as well as “foreignKey”. You can format or convert the persisted data type to other types using “converted” or “formatted” methods.
Each field that needs to be displayed in the Android UI must support getting and setting its value from/to a View.
Normally the View has an ID, for which the “viewId” method is provided. You can provide to it an id in the form "viewId(classOf®, “XXX”, …)" or “viewId(R.id.XXX, …)”. The former works even before you generate the UI, so it is used most often. However, it uses Reflection, so replacing it with the former may be good once the UI is generated.
In order to save and restore the state of the UI, each displayed field should support getting/setting to/from a Bundle. For persisted fields, this is already provided. Otherwise, the bundleField method should be used. Without doing this, the UI may show empty values when rotating the screen, or returning to an Activity.