realm

“realm migration needed”, exception in android while retrieving values from realm db

佐手、 提交于 2019-11-26 16:08:08
I am using Realm as a back end in my application. I have created one table named Setting. I added values in that table, by following the steps given on Realm's official site. But when I am going to retrieve values from that table in, I getting exception "io.realm.exceptions.RealmMigrationNeededException: RealmMigration must be provided" on the line:" realm=Realm.getInstance(getApplicationContext());". Actually, I am new to android and Realm, so finding trouble to understand what is problem. 1911z EDIT: for new versions of Realm, Realm.init(Context context) is added Realm.init(context);

RealmChangeListener does not get called when Realm gets updated in NotificationListenerService

≡放荡痞女 提交于 2019-11-26 15:29:58
I'm doing Realm insertions on a extended NotificationListenerService , like this: public class NLService extends NotificationListenerService { @Override public void onNotificationPosted(StatusBarNotification sbn) { // building realmObject here mRealm = Realm.getDefaultInstance(); RealmHelper.saveObj(myRealmObject, mRealm); // mRealm.waitForChange(); / mRealm.refresh(); mRealm.close(); } } public class RealmHelper { public static RealmModel saveObj(RealmObject realmObject, Realm realm) { realm.beginTransaction(); RealmObject newRealmObject = realm.copyToRealm(realmObject); realm

How do I view my Realm file in the Realm Browser?

佐手、 提交于 2019-11-26 13:58:45
I've just discovered Realm and wanted to explore it in more detail so I decided to create sample application and having a mess around with it. So far so good. However, one thing I haven't been able to work out just yet is how to view my database in the Realm Browser. How can this be done? Christian Melchior Currently the Realm Browser doesn't support accessing databases directly on the device, so you need to copy the database from the emulator/phone to view it. That can be done by using ADB: adb pull /data/data/<packagename>/files/ . That command will pull all Realm files created using Realm

how to implement filterable in RealmRecyclerViewAdapter

只愿长相守 提交于 2019-11-26 13:49:19
I'm using well RealmRecyclerViewAdapter. My problem is to implement a Filterable that not works. This is the code: private class AirportAdapter extends RealmRecyclerViewAdapter<AirportR,RecyclerView.ViewHolder> implements Filterable { Context context; OrderedRealmCollection<AirportR>listAirports; public AirportAdapter(Context activity, OrderedRealmCollection<AirportR>airports) { super(activity,airports, true); this.context = activity; this.listAirports = airports; } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from

Gson deserialization of List<String> into realmList<RealmString>

若如初见. 提交于 2019-11-26 13:06:28
问题 I\'m using retrofit with gson to deserialize my json into realm objects. This works very well for the most part. Trouble arises when dealing with RealmList(String(or any other basic data type)) Since Realm doesnt support RealmList where E doesnt extend Realm object, I wrapped String in a RealmObject. public class RealmString extends RealmObject { private String val; public String getValue() { return val; } public void setValue(String value) { this.val = value; } } My realm Object is as below

How to find my realm file?

江枫思渺然 提交于 2019-11-26 12:33:57
I have created a DB by realm and I am not able to find the file as my OS (Yosemite) dont have a mobile folder in the /private/var/mobile. How should I access my realm to run in the browser? Cross posted from google groups yoshyosh Finding a Realm File For Android How to view my Realm file in the Realm Browser? For iOS If your App is on Device Make sure that your device is connected and go to the devices window in the Xcode menu Window > Devices (⌘⇧2). There you will be able to choose your device and your app from a list of installed apps with debugging permissions. After selecting your app, go

How to filter the data in realm adapter?

梦想的初衷 提交于 2019-11-26 11:34:22
问题 I am facing the issue in filtering the data in the realm adapter. I am creating the searchview to search data by filtering the data in realm adapter. My code for searchview implementation is @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.main_menu, menu); final MenuItem item = menu.findItem(R.id.action_search); final SearchView searchView = (SearchView) MenuItemCompat.getActionView(item); Log.e(\"Filter \",\"Filtering\"); searchView

Realm with pre populated data into assets?

旧城冷巷雨未停 提交于 2019-11-26 09:48:09
问题 Normally I use Realm as: RealmConfiguration config = new RealmConfiguration.Builder(applicationContext).deleteRealmIfMigrationNeeded().build(); How can I add to the assets folder of my project a database with data and read it? 回答1: Since Realm Java 0.91.0 there has been an assetFile(String) option on the RealmConfiguration that automatically will copy a file from assets and use that if needed (e.g. if the Realm is opened the first time or has been deleted for some reason): RealmConfiguration

Cannot retrieve field values from realm object, values are null in debugger

六月ゝ 毕业季﹏ 提交于 2019-11-26 08:55:56
It seems like my RealmObject values are being hidden by the RealmProxy class, but can be set from the proxyclass. My model is pretty straight forward as you can see. public class GroupRealm extends RealmObject { @PrimaryKey public String id; @Index public String name; public String imageUrl; public int order; public GroupRealm parent; public RealmList<GroupRealm> children; public RealmList<ContentRealm> contents; } This is how i am setting the values(db is a valid Realm, and everything is in a transaction that commits fine): GroupRealm gr = db.where(GroupRealm.class).equalTo("id",g.GroupID)

Android: Realm + Retrofit 2 + Gson

南楼画角 提交于 2019-11-26 07:48:19
问题 I have a problem when using Retrofit + Gson and Realm . I know that there is an issue with the combination of these 3 libraries. Some answers suggest that setting an ExclusionStrategy for Gson can solve this issue, and I tried it but it didn\'t work. My code looks like: public class ObjectList { public List<AnotherObject> anotherObject; } public class AnotherObject extends RealmObject { private String propA; public void setPropA(String propA){ this.setPropA = propA } public String getPropA(){