use of sqlite.feature.typeadapter.bitmap.BindAppDataSource.Transaction in project kripton by xcesco.
the class TestFeatureSQLTypeAdapterBitmapRuntime method testSelect.
@Test
public void testSelect() {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
final Bitmap bitmap = BitmapFactory.decodeFile("/src/test/resources/imgs/img.png", options);
BindAppDataSource ds = BindAppDataSource.instance();
ds.execute(new Transaction() {
@Override
public TransactionResult onExecute(BindAppDaoFactory daoFactory) {
Person bean = new Person();
bean.image = bitmap;
daoFactory.getDaoPerson().insert(bean);
List<Person> list = daoFactory.getDaoPerson().list();
for (Person person : list) {
// use
saveImage((new File("src/test/resources/imgs/img0.png")).getAbsolutePath(), person.image);
}
return TransactionResult.COMMIT;
}
});
}
Aggregations