方便简单的查看 ObjectBox data.mdb 数据。
Object Box 是个好东西,效率很棒,我估计迟早会取代 GreenDao,可是查看存储的内容却非常不方便,找了一下还没找到什么好用的,那只能自己写一个喽。
GitHub 原文:https://github.com/renyuzhuo/rviewer
RViewer
A library to check the data saved by ObjectBox.
Getting started
In your build.gradle
:
dependencies {
debugCompile 'cn.renyuzhuo.rviewer:rviewer:1.0.2'
releaseCompile 'cn.renyuzhuo.rviewer:rviewer-no-op:1.0.2'
}
In your Application
class:
public class App extends Application {
private BoxStore boxStore;
private static App app;
@Override
public void onCreate() {
super.onCreate();
boxStore = MyObjectBox.builder().androidContext(this).build();
app = this;
ArrayList<Class> classes = new ArrayList<>();
classes.add(Note.class); // Your Entitys
ObjectViewBoxManager.getInstance().init(boxStore, classes);
}
}
Notice: You Should all Add toString() like:
@Override
public String toString() {
return "Note{" +
"id=" + id +
", text='" + text + '\'' +
", date=" + date +
'}';
}
All the things is done.
Thanks
License
MIT