我剛剛接觸了一個android項目,不幸的是老團隊已經離開了,我仍然無能爲力。關閉跨越不同文件的領域
如下
活動,片段,境界(包含CRUD文件& DAO文件以及)項目的結構
mainActivity:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu_drawer_activity);
ButterKnife.bind(this);
EventBus.getDefault().register(this);
setSupportActionBar(toolbar);
String ChannelId = UAirship.shared().getPushManager().getChannelId();
Realm.init(this);
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().schemaVersion(2).deleteRealmIfMigrationNeeded().build();
Realm.setDefaultConfiguration(realmConfiguration); // Make this Realm the default
realm = Realm.getInstance(realmConfiguration);
showInitalFragment();
setUserInfoInNaviagtionDrawer();
setupUI();
}
// some logic
@Override
protected void onDestroy() {
EventBus.getDefault().unregister(this);
realm.close();
super.onDestroy();
}
現在CRUD文件和DOA這裏面
發生了什麼事:
CRUDfile1.java:http://ideone.com/fs0RYo
個DAOfile1.java:http://ideone.com/1klhW8
現在的問題是,有一個LOF OT領域實例創建並保持打開大量的內存取,有時會導致應用程序崩潰,我無法將其關閉(該應用程序將崩潰,因此評論)。任何想法我應該如何解決這個問題?
沒關係,你能給我一個關於我發佈的代碼的例子嗎? – xxqxpxx
哦,哇,你的同伴將'RealmResults'(這是一個List)映射到一個'ArrayList',但它們將它們作爲管理對象。而'get'方法實際上並不返回一個列表,他們接受一個輸入列表,該列表被修改爲包含新列表....哇,這是超級糟糕的。這是兩個世界中最糟糕的。 – EpicPandaForce
我知道它的低劣工作。對不起,你必須看到這個:/ – xxqxpxx