home › Forums › # Technical Support › need for helping › Reply To: need for helping
January 6, 2015 at 08:24
#1602
Keymaster
Hi,
thanks for your responses. As vurtue mentions, use the UI component instead of the logger.
In addition, you should have the engine as a member of your class such that you can retrieve the engine later in a different method. For example,
public class MyActivity extends Activity {
private Engine engine;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MyFuzzy myFuzzy=new MyFuzzy();
try {
engine = new Engine(“simple-dimmer”);
InputVariable ambient = new InputVariable();
ambient.setName(“Ambient”);
...
}
public void someOtherMethodCalledByAnEvent(){ //A button click?
engine.getInputVariable("Ambient").setInputValue(someUiComponent.getDoubleValue());
engine.process();
double output = engine.getOutputVariable("Power").defuzzify();
anotherUiComponent.setText(Op.str(output));
}
I hope this helps.
Cheers.