Im using the ActiveAndroid library and I have read the entire information (very minimalist and insufficient unfortunately)
There is no mention whether the .save()
operation is executed syncrhonously.
If it is asynchronous, how do I "listen" for it to end before proceeding?
http://www.activeandroid.com/ - this is the documentation I read
If you have a look at the source code of the Model class, you'll see that the save
method does not do any thread handling:
public final Long save() {
final SQLiteDatabase db = Cache.openDatabase();
final ContentValues values = new ContentValues();
for (Field field : mTableInfo.getFields()) {
/* ... */
}
if (mId == null) {
mId = db.insert(mTableInfo.getTableName(), null, values);
}
else {
db.update(mTableInfo.getTableName(), values, idName+"=" + mId, null);
}
Cache.getContext().getContentResolver()
.notifyChange(ContentProvider.createUri(mTableInfo.getType(), mId), null);
return mId;
}
Saving thus occurs synchronously.