NullReferenceException
如何在这里发生:
public class DataContextBinder extends Binder {
private static final String DATA_CONTEXT = "DataContext";
// Fields
private final Listener<PropertyChangedEventArgs<Object>> dataContextListener = new Listener<PropertyChangedEventArgs<Object>>() {
@Override
public void onEvent(PropertyChangedEventArgs<Object> args) {
setSource(args.getNewValue());
}
};
// Constructors
protected DataContextBinder(Object target, String targetPropertyName,
Binding binding) {
super(Property.getPropertyValue(target, DATA_CONTEXT), target,
targetPropertyName, binding);
}
// Methods
protected void createListeners(Object source) {
Log.e("DataContextBinder", "DCL = " + dataContextListener.toString());
// It throws NullPointerException on dataContextListener.toString()
Property.addPropertyChangedListener(getTarget(), DATA_CONTEXT,
dataContextListener);
super.createListeners(source);
}
protected void removeListeners(Object source) {
Property.removePropertyChangedListener(getTarget(), DATA_CONTEXT,
dataContextListener);
super.removeListeners(source);
}
}
答案 0 :(得分:1)
dataContextListener
是null
..