本文整理匯總了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();
}