本文整理匯總了Java中io.realm.Realm.delete方法的典型用法代碼示例。如果您正苦於以下問題:Java Realm.delete方法的具體用法?Java Realm.delete怎麽用?Java Realm.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.realm.Realm
的用法示例。
在下文中一共展示了Realm.delete方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateDAB
import io.realm.Realm; //導入方法依賴的package包/類
@Override
public void updateDAB(Object object) {
JSONObject jsonObject = (JSONObject) object;
String username = "", password = "";
try {
username = jsonObject.getString("username");
password = jsonObject.getString("password");
} catch (Exception e) {
e.printStackTrace();
}
Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
realm.delete(User.class);
User user = realm.createObject(User.class);
user.setUsername(username);
user.setPassword(password);
realm.commitTransaction();
mainController.updateResponse(user);
}
示例2: deleteAll
import io.realm.Realm; //導入方法依賴的package包/類
@Override
public Flowable<Integer> deleteAll() {
final Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
RealmQuery<T> query = realm.where(clazz);
long count = query.count();
realm.delete(clazz);
realm.commitTransaction();
realm.close();
return Flowable.just((int)count);
}
示例3: clearInstance
import io.realm.Realm; //導入方法依賴的package包/類
public static void clearInstance() {
Realm realm = Realm.getInstance(configuration);
realm.beginTransaction();
realm.delete(UserFactoryStore.class);
realm.commitTransaction();
realm.close();
}
示例4: clearAll
import io.realm.Realm; //導入方法依賴的package包/類
public void clearAll() {
Realm mRealm = Realm.getInstance(mRealmConfiguration);
mRealm.beginTransaction();
mRealm.delete(Repo.class);
mRealm.delete(Issue.class);
mRealm.delete(User.class);
mRealm.commitTransaction();
mRealm.close();
}