我已決定爲我的項目使用Realm。我瀏覽了文檔,無法理解如何將所有手機聯繫人導入我的Realm數據庫。 以前有沒有人做過這樣的項目?請幫忙。在Realm中批量插入
我已經使用了Sugar ORM,它有一個批量插入選項。 Realm是否有相同的或者是否有替代方案?
這是我做了什麼至今:
package com.advisualinc.switchchat.Realm_DB;
import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;
/**
* Created by Veeresh on 10/19/2015.
*/
public class R_ContactDB extends RealmObject {
private String name;
@PrimaryKey
private String phone;
private boolean matchedWithRecent;
private int status;
public R_ContactDB(String name, String phone, boolean matchedWithRecent, int status)
{
this.name = name;
this.phone = phone;
this.matchedWithRecent = matchedWithRecent;
this.status = status;
}
public R_ContactDB()
{
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public boolean isMatchedWithRecent() {
return matchedWithRecent;
}
public void setMatchedWithRecent(boolean matchedWithRecent) {
this.matchedWithRecent = matchedWithRecent;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
爲什麼downvote?請幫助 –
請更具體地說明您嘗試過什麼,哪些不起作用。 – Adrenaxus
我有同樣的查詢 –