2

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.

Akeshwar Jha
  • 4,516
  • 8
  • 52
  • 91
Siddharth_Vyas
  • 9,972
  • 10
  • 39
  • 69

2 Answers2

1

Now I am able to run the application.

Below is the solution :

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

Thanks.

Siddharth_Vyas
  • 9,972
  • 10
  • 39
  • 69
  • That solution wasn't very helpful–the collaborator said he'd modify the code to not require AspectJ. I have no idea what version that applies to, but I can only assume it's made it to the latest (v0.8.9 atm). Any idea why I might still have this issue? – adamdport Feb 18 '15 at 18:07
1

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;
    }
}
Arivan Bastos
  • 1,876
  • 1
  • 20
  • 28