implement map globe Rajawali into fragment Android

Viewed 336

I have problems with incorporating the world map on a fragment android Since an activity is performed in this way :

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final RajawaliSurfaceView surface = new RajawaliSurfaceView(this);
    surface.setFrameRate(60.0);
    surface.setRenderMode(IRajawaliSurface.RENDERMODE_CONTINUOUSLY);

    // Add mSurface to your root view
    addContentView(surface, new  ActionB

ar.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT));

    renderer = new Renderer(this);
    surface.setSurfaceRenderer(renderer);
}

But when I want to do it in a fragment gives me error line

addContentView(surface, new  ActionBar.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT));


  @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        final RajawaliSurfaceView surface = new RajawaliSurfaceView(getActivity());
        surface.setFrameRate(60.0);
        surface.setRenderMode(IRajawaliSurface.RENDERMODE_CONTINUOUSLY);

        // Add mSurface to your root view
        addContentView(surface, new ActionBar.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT));

        renderer = new Renderer(getActivity());
        surface.setSurfaceRenderer(renderer);
    }
1 Answers
Related