Android RoboBinding firePropertyChange() undefined error

664 Views Asked by At

I am currently working on Android data binding application.

I am using android "RoboBinding" library for binding Model-View and View-Model.

I have used sample application from here for reference.

This is my PresentationModel.java class :

@org.robobinding.presentationmodel.PresentationModel
public class PresentationModel implements
    org.robobinding.property.ObservableBean {
private String name;

public String getHello() {
    return name + ": hello Android MVVM(Presentation Model)!";
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public void sayHello() {
    firePropertyChange(name);

}

@Override
public void addPropertyChangeListener(String arg0,
        PropertyChangeListener arg1) {
    // TODO Auto-generated method stub

}

@Override
public void removePropertyChangeListener(String arg0,
        PropertyChangeListener arg1) {
    // TODO Auto-generated method stub

}

}

But it displays error as : The method firePropertyChange(String) is undefined for the type PresentationModel PresentationModel.java

Tried example with following jar files :

  1. robobinding-0.8.4-jar-with-dependencies.jar
  2. robobinding-0.8.4-SNAPSHOT-jar-with-dependencies
  3. robobinding-0.8.5-SNAPSHOT-jar-with-dependencies

Here is the screen shot of error :

Error Trace

Any help will be appreciated.

Thanks.

2

There are 2 best solutions below

1
On BEST ANSWER

Now I am able to run the application.

Below is the solution :

https://github.com/RoboBinding/AndroidMVVM/issues/1

Thanks.

0
On

If you don't want to use AspectJ you should create a PresentationModelChangeSupport property, and call firePropertyChange() method:

@org.robobinding.annotation.PresentationModel
public class PresentationModel implements HasPresentationModelChangeSupport {

    protected PresentationModelChangeSupport mChangeSupport;
    private String name;

    public PresentationModel()
    {
        mChangeSupport = new PresentationModelChangeSupport(this);
    }

    public String getHello() {
        return name + ": hello Android MVVM(Presentation Model)!";
    }

    public void sayHello() {
        mChangeSupport.firePropertyChange("hello");
    }

    @Override
    public PresentationModelChangeSupport getPresentationModelChangeSupport() {
        return mChangeSupport;
    }
}