Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

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

Open
frank0123 opened this issue May 9, 2019 · 2 comments

Comments

@frank0123
Copy link

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

        // only support getSupportActionBar()
        FragmentManager fm = getSupportFragmentManager();
    }
}
@stringnotfound1
Copy link
Contributor

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.

@bofetadas
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants