本文整理汇总了Java中io.realm.RealmResults.deleteAllFromRealm方法的典型用法代码示例。如果您正苦于以下问题:Java RealmResults.deleteAllFromRealm方法的具体用法?Java RealmResults.deleteAllFromRealm怎么用?Java RealmResults.deleteAllFromRealm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.realm.RealmResults
的用法示例。
在下文中一共展示了RealmResults.deleteAllFromRealm方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: btn_logout_click
import io.realm.RealmResults; //导入方法依赖的package包/类
public void btn_logout_click(View v) {
RealmConfiguration config = new RealmConfiguration.Builder().name("yyox.realm").build();
Realm objRealm = Realm.getInstance(config);
//查找
RealmUser realmUser = objRealm.where(RealmUser.class).findFirst();
if (realmUser != null) {
//先删除
objRealm.beginTransaction();
RealmResults results = objRealm.where(RealmUser.class).findAll();
results.deleteAllFromRealm();
objRealm.commitTransaction();
}
mPresenter.requestLogout(this);
WEApplication weApplication = (WEApplication) getApplication();
weApplication.setRealmUser(null);
Intent intent = new Intent();
setResult(CodeDefine.SETTING_RESULT, intent);
}
示例2: logoutRealmUser
import io.realm.RealmResults; //导入方法依赖的package包/类
private void logoutRealmUser() {
//注册成功写数据库
RealmConfiguration config = new RealmConfiguration.Builder().name("yyox.realm").build();
Realm objRealm = Realm.getInstance(config);
//查找
RealmUser realmUser = objRealm.where(RealmUser.class).findFirst();
if (realmUser != null) {
//先删除
objRealm.beginTransaction();
RealmResults results = objRealm.where(RealmUser.class).findAll();
results.deleteAllFromRealm();
objRealm.commitTransaction();
//再添加
objRealm.beginTransaction();
RealmUser realmUserNew = objRealm.createObject(RealmUser.class);
realmUserNew.setName("");
objRealm.commitTransaction();
mRealmUser = null;
}
}
示例3: deleteProfil
import io.realm.RealmResults; //导入方法依赖的package包/类
/**
* method menghapus Profil berdasarkan id
*
* @param id
*/
public void deleteProfil(int id) {
realm.beginTransaction();
RealmResults<Profil> dataResults = realm.where(Profil.class).equalTo("id", id).findAll();
dataResults.deleteAllFromRealm();
realm.commitTransaction();
showToast("Hapus data berhasil.");
}
示例4: deleteAkademmik
import io.realm.RealmResults; //导入方法依赖的package包/类
/**
* method menghapus Akademik berdasarkan id
*
* @param id
*/
public void deleteAkademmik(int id) {
realm.beginTransaction();
RealmResults<Akademik> dataResults = realm.where(Akademik.class).equalTo("id", id).findAll();
dataResults.deleteAllFromRealm();
realm.commitTransaction();
showToast("Hapus data berhasil.");
}
示例5: deleteOrganisasi
import io.realm.RealmResults; //导入方法依赖的package包/类
/**
* method menghapus Organisasi berdasarkan id
*
* @param id
*/
public void deleteOrganisasi(int id) {
realm.beginTransaction();
RealmResults<Organisasi> dataResults = realm.where(Organisasi.class).equalTo("id", id).findAll();
dataResults.deleteAllFromRealm();
realm.commitTransaction();
showToast("Hapus data berhasil.");
}
示例6: deleteLainnya
import io.realm.RealmResults; //导入方法依赖的package包/类
/**
* method menghapus Lainnya berdasarkan id
*
* @param id
*/
public void deleteLainnya(int id) {
realm.beginTransaction();
RealmResults<Lainnya> dataResults = realm.where(Lainnya.class).equalTo("id", id).findAll();
dataResults.deleteAllFromRealm();
realm.commitTransaction();
showToast("Hapus data berhasil.");
}
示例7: delete
import io.realm.RealmResults; //导入方法依赖的package包/类
public static <O extends RealmObject> void delete(Realm realmInstance, QueryFilters filters, Class<O> clazz){
Realm realm = realmInstance;
realm.beginTransaction();
RealmQuery<O> query = realm.where(clazz);
query = filters.copyToRealmQuery(query);
final RealmResults<O> results = query.findAll();
results.deleteAllFromRealm();
realm.commitTransaction();
realm.close();
}
示例8: saveContacts
import io.realm.RealmResults; //导入方法依赖的package包/类
/**
* save contacts data into local storage
* @param contacts
*/
public static void saveContacts(final RealmList<RealmContact> contacts ){
Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
final RealmResults<RealmContact> results = realm.where(RealmContact.class).findAll();
results.deleteAllFromRealm();
realm.copyToRealmOrUpdate(contacts);
realm.commitTransaction();
}
示例9: removeBookFromDatabase
import io.realm.RealmResults; //导入方法依赖的package包/类
public void removeBookFromDatabase(String id) {
Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
RealmResults<BookDB> results = realm.where(BookDB.class).equalTo("idBook", id).findAll();
results.deleteAllFromRealm();
realm.commitTransaction();
}
示例10: deleteAllFromDB
import io.realm.RealmResults; //导入方法依赖的package包/类
public void deleteAllFromDB() {
Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
RealmResults<BookDB> results = realm.where(BookDB.class).findAll();
results.deleteAllFromRealm();
realm.commitTransaction();
}
示例11: Reset
import io.realm.RealmResults; //导入方法依赖的package包/类
public void Reset(){
RealmResults<StepCounts> results = realm.where(StepCounts.class).findAll();
realm.beginTransaction();
results.deleteAllFromRealm();
realm.commitTransaction();
}
示例12: deleteRecord
import io.realm.RealmResults; //导入方法依赖的package包/类
public void deleteRecord(String id){
RealmResults<Note> results = realm.where(Note.class).equalTo("id", id).findAll();
realm.beginTransaction();
results.deleteAllFromRealm();
realm.commitTransaction();
}