rosjava/android_core

It's seems we can't getSupportFragmentManager() from AppCompatRosActivity ?!

Opened this issue · 2 comments

public class TestActivity extends AppCompatRosActivity implements NodeMain {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ...

        // only support getSupportActionBar()
        FragmentManager fm = getSupportFragmentManager();
    }
}

You should be able to get the deprecated FragmentManager instead of the one from the support library. This also means that you have to use the deprecated Fragments.

I'm currently doing it this way and haven't gotten any problems so far.

I came across the same problem and eventually solved it by not making use of ROSActivity or AppCompatROSActivity anymore. With these Activities, a few disadvantages come along including:

You cannot time the initialization of your nodes. Every time your activity is created/started/resumed 'init' function is called. This is especially bad if you may have service clients which are dependent on their service servers. Due to the fact that rosjava does not offer any 'wait_for_service_ functionality as the python implementation does, initialization of service clients will fail if their service server isn't up and running yet.

Another issue is that AppCompatROSActivity is pretty old and therefore - as you indicated - doesn't make use of the new supportFragmentManager.

If you want to learn how to get rid of using ROSActivity, have a look here:

rosjava without ROS activity