Several months ago, my question was solved in the next thread: https://stackoverflow.com/questions/tagged/sphero-api?sort=newest
But now, the SKD Sphero 2.0 has made several changes. By now, when I connect with a Sphero and I need to move to another activity and keeping the synchrony, and I check if the Sphero ID is correct and it is. But the problem is when I try to find a robot with that id:
This code is in the new activity, the previous was connected with sphero with SpheroConnectionView :
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final String robot_id = getIntent().getStringExtra(ButtonDriveActivity.EXTRA_ROBOT_ID);
setContentView(R.layout.mjoystick);
if (robot_id != null && !robot_id.equals("")) {
mRobot =(Sphero) RobotProvider.getDefaultProvider().findRobot(robot_id);
...} }
The result of making .findRobot with the ID of my Sphero is null. So please tell me what is wrong.Thanks