I want to see the values of Realm object variables
Student (int studentID, ArrayList <Subject> subjectList)
Subject (int subjectID, String subjectName)
I want to see the names of subjects in a student object when debugging using Android Studio.
Where should I look in android studio debug window to find a student's the subjects list?
Realm proxies your model objects and is a zero-copy storage system so in order to inspect the value of a field you need to use the evaluate expression feature of the debugger.
We are considering the possibility to write a plugin for the debugger to show the values directly, but that is still at an investigation stage.
You cannot directly do like that.
this my approach.
List<FooObject> messages = realm.copyFromRealm(value);
And you can see in debugger values from messages.
Full Code
realm.where(FooObject.class).equalTo(FooObject.id, id).findAllAsync().asObservable()
.filter(new Func1<RealmResults<FooObject>, Boolean>() {
@Override
public Boolean call(RealmResults<FooObject> message) {
return message.isLoaded();
}
}).subscribe(new SimpleObserver<RealmResults<FooObject>>() {
@Override
public void onCompleted() {
super.onCompleted();
}
@Override
public void onNext(RealmResults<FooObject> value) {
super.onNext(value);
List<FooObject> messages = realm.copyFromRealm(value);
RLog.d(TAG, "Messages");
}
@Override
public void onError(Throwable e) {
super.onError(e);
}
@Override
public String getTag() {
return TAG;
}
});
You can use Stheto from FaceBook. You will be able to see dynamic changes and all table etc. here is the link : https://github.com/uPhyca/stetho-realm
I will explain here: import the lib from gradle with
> compile 'com.facebook.stetho:stetho:1.5.0'
> compile 'com.uphyca:stetho_realm:2.1.0'
then in a class extends Application (dont forget to notify the manifest about your class :
<application
android:allowBackup="true"
tools:ignore="AllowBackup"
android:name=".YourClassName"
then add this
public class YourClassName extends Application {
...
@Override
public void onCreate() {
Stetho.initialize(
Stetho.newInitializerBuilder(this)
.enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
.enableWebKitInspector(RealmInspectorModulesProvider.builder(this).build())
.build());
finnaly open chrome on this url
chrome://inspect/#devices
And click on inspect. Go on Ressources then on Web Sql. You will be able to see your db like that
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With