當前位置: 首頁>>代碼示例>>Java>>正文


Java RealmResults.deleteAllFromRealm方法代碼示例

本文整理匯總了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);
}
 
開發者ID:Zyj163,項目名稱:yyox,代碼行數:22,代碼來源:UserSettingActivity.java

示例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;
    }
}
 
開發者ID:Zyj163,項目名稱:yyox,代碼行數:23,代碼來源:WEApplication.java

示例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.");
}
 
開發者ID:setakarim,項目名稱:ingetin,代碼行數:16,代碼來源:RealmHelper.java

示例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.");
}
 
開發者ID:setakarim,項目名稱:ingetin,代碼行數:16,代碼來源:RealmHelper.java

示例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.");
}
 
開發者ID:setakarim,項目名稱:ingetin,代碼行數:16,代碼來源:RealmHelper.java

示例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.");
}
 
開發者ID:setakarim,項目名稱:ingetin,代碼行數:16,代碼來源:RealmHelper.java

示例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();
}
 
開發者ID:rezkyatinnov,項目名稱:kyandroid,代碼行數:11,代碼來源:LocalData.java

示例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();
}
 
開發者ID:AppHero2,項目名稱:Raffler-Android,代碼行數:13,代碼來源:AppManager.java

示例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();
}
 
開發者ID:OlegKlimenko,項目名稱:Plamber-Android,代碼行數:8,代碼來源:BookUtilsDB.java

示例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();
}
 
開發者ID:OlegKlimenko,項目名稱:Plamber-Android,代碼行數:8,代碼來源:BookUtilsDB.java

示例11: Reset

import io.realm.RealmResults; //導入方法依賴的package包/類
public void Reset(){
    RealmResults<StepCounts> results = realm.where(StepCounts.class).findAll();

    realm.beginTransaction();

    results.deleteAllFromRealm();

    realm.commitTransaction();
}
 
開發者ID:PacktPublishing,項目名稱:Android-Wear-Projects,代碼行數:10,代碼來源:MainActivity.java

示例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();
}
 
開發者ID:PacktPublishing,項目名稱:Android-Wear-Projects,代碼行數:10,代碼來源:MainActivity.java


注:本文中的io.realm.RealmResults.deleteAllFromRealm方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。