我的问题可能有点尴尬:
singleton
,其中包含对我的对象的许多引用。我在singleton
我的活动中初始化了UI
Realm
realm.where(myobj.class).first();
activity
在我的ViewPager
我有一个fragments
,其中有fragments
个Singleton's properties.
。那些fragments
指的是singleton object properties
public class OpenedIntervention {
private static OpenedIntervention openedIntervention;
public static OpenedIntervention getIstance() {
if (openedIntervention == null) {
openedIntervention = new OpenedIntervention();
}
return openedIntervention;
}
public void dispose() {
openedIntervention = null;
}
private Intervention intervention = null;
//getter setter
}
{}}中,我需要更新部分//...
Intervention i = realm.where(Intervention.class).equalTo("ID", intId).findFirst(); //this realm istance has activity-scope
openedIntervention.setIntervention(i);
//...
,但我希望使用异步交易进行更新。观察它导致线程域错误。单
realm.executeTransactionAsync(
new Realm.Transaction() {
@Override
public void execute(Realm realm) {
//...
openedIntervention.getIntervention().setTIPOLOGIA_INTERVENTO(etInterventionType.getText().toString());
openedIntervention.getIntervention().setTIPOLOGIA_INTERVENTO_ID(etInterventionType.getTag().toString());
}
},
new Realm.Transaction.OnSuccess() {
@Override
public void onSuccess() {
//...
}
},
new Realm.Transaction.OnError() {
@Override
public void onError(Throwable error) {
//...
}
});
我的活动初始化:
Error converting to Python objects to String/UTF8: Got Python object of type float but can only handle these types: str, bytes
我的片段,我想做的事情:
pandas.read_csv
关于如何解决这个问题的任何想法?我想做异步以避免滞后