Disable render(MapCanvas) on Renderable

  • Replies:1
  • OpenNot stickiedUnanswered
  • Forum posts: 4

Jun 17, 2015 10:42:35 PM via Website

I've several views on a GlMap.

    GLMap glMap = (GLMap) findViewById(R.id.glMap);
    glMap.addWidget((HeightDigitalView) findViewById(R.id.heightDigital));
    glMap.addWidget((HeightHistoryView) findViewById(R.id.heightHistory));
    glMap.addWidget((SpeedDigitalView) findViewById(R.id.speedDigital));

Now I have a preferences menu with preferences.xml. I want the user to enable/disable the views as he wants
Checkbox "Show HeightDIgitalView"
Checkbox "Show HeightHistoryView"

Removing or setting invisible the view is easy (View.GONE)

    View myView = findViewById(R.id.heightDigital);
    ViewGroup parent = (ViewGroup) myView.getParent();

But how on earth can I get it done, that renderer is not called anymore on the view?

public class HeightDigitalView extends TextView implements Renderable {

    public void render(MapCanvas mapCanvas) {
        if (positionProviderService.getCurrentLocation() != null) {
        double altitude = positionProviderService.getCurrentLocation().getAltitude();


When I remove the view "render" is still invoked.
As far as I have many views with lot of functionality and the app shouldn't use much battery and it's runned for hours for me it's important to optimize the application - so don't call render on not showed views.

Thanks for help!

  • Forum posts: 4

Jun 17, 2015 10:47:14 PM via Website

Of course one option is to check at the beginning of the render method if view is visible but that's only a workaround for me