Several months I had a problem when I went from one activity to another and I wanted to keep the synchronism with Sphero all the time. The solution was passing the id of the Sphero by Intent and recouping it with the next code:
@Override
public void onCreate(Bundle savedInstanceState) {
super.OnCreate(savedInstanceState);
// get the robot object sent through to this Activity
String robotId = getIntent().getStringExtra("robot.id");
Robot robot = RobotProvider.getDefaultProvider().findRobot(robotId);
}
I have the same problem because of the Sphero SDK has changed for the model 2.0.
In this API I did the same to pass robotId from a Activity to another (by Intent), but for instancing the robot in the newest Activity, by doing the next code doesn't work:
Robot robot = RobotProvider.getDefaultProvider().findRobot(robotId); Sphero mRobot= (Sphero) robot;
In fact, I have checked if robotId is filled with a correct value and this is correct, but I have null value in robot.