Problem with attempt to invoke interface method
protected void boardReady() throws com.mbientlab.metawear.UnsupportedModuleException
{
tempModule= mwBoard.getModuleOrThrow(Temperature.class);
Temperature.Sensor tempsensor = tempModule.sensors()[0];
tempsensor.addRouteAsync(source -> source.stream((data, env) -> {
Log.i("boardReady", "*****************************");
runOnUiThread(new Runnable() {
@Override
public void run() {
textview.setText("Temperature (C) = " + data.value(Float.class).toString());
}
});
}
)).continueWithTask(task -> {
streamRoute = task.getResult();
if(task.isFaulted())
Log.e("boardReady", "*****************************1");
return timerModule.scheduleAsync(TEMP_SAMPLE_PERIOD, false, tempsensor::read);
}).continueWithTask(task -> {
if(task.isFaulted()) {
Log.e("boardReady", "*****************************2");
Log.e("boardReady", task.getError().getMessage());
}
scheduledTask = task.getResult();
scheduledTask.start();
return null;
});
}
this is what log says
E/boardReady: *****************************2
E/boardReady: Attempt to invoke interface method 'bolts.Task com.mbientlab.metawear.module.Timer.scheduleAsync(int, boolean, com.mbientlab.metawear.CodeBlock)' on a null object reference
This discussion has been closed.
Comments
timerModule
variable?you mean that variable? because private timerModule doesn't work. Thanks for answering.