Create Multiple Model Realm

public boolean synceTransaction(final List<T> list){

    if(list.size() == 0) return false;


    realm = Realm.getInstance(getConfiguration());

    realm.executeTransactionAsync(new Realm.Transaction() {
        public void execute(Realm realm) {
            for(int i = 0;i<list.size();i++) {
    }, new Realm.Transaction.OnSuccess() {
        public void onSuccess() {
            Log.d("Status", "Successfully");
    }, new Realm.Transaction.OnError() {
        public void onError(Throwable error) {
            Log.d("Error", error.getMessage());

    return true;

//set this configuration to allow create multiple realm model in android
public RealmConfiguration getConfiguration() {
    return new RealmConfiguration

public void setConfiguration(RealmConfiguration configuration) {
    this.configuration = configuration;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s