Anonymous Routes
I have been trying to create an anonymous route for the step counter. I have tried running the example code here but get the following error when trying to obtain the identifier: "java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String com.mbientlab.metawear.Route.generateIdentifier(int)' on a null object reference". 'task.getResult()' returns 'null'. I have also tried running variations of the code almost identical to the reference with other sensors with the same result. Is the code still valid? TIA for the guidance.
This discussion has been closed.
Comments
(where private MetaWearBoard board;)
// create a route to log gyro y-axis data
this.board.getModule(GyroBmi160.class).angularVelocity().addRouteAsync(new RouteBuilder() {
@Override
public void configure(RouteComponent source) {
source.split().index(1).log(null);
}
}).continueWith(new Continuation() {
@Override
public Void then(Task task) throws Exception {
// save the result of generateIdentifier and hardcode
// value in anonymous route
Log.i("MainActivity", "subscriber (0) = " + task.getResult().generateIdentifier(0));
return null;
}
});
null
in this context, which indicates the task failed. Confirm that the task did fail and post its error.