BlackBerry invalidate speed problem

273 views Asked by At

I have custom field with volume slider (just color line), I want to update slider on trackpad movement, is there some other way then invoking invalidate? Because this is realy slow for me, a tried also invalidating only region but whit same result. So is there some way how to repaint part of field without invalidate?

protected boolean navigationMovement(int dx, int dy, int status, int time) {
    if (dx >0) {
        if (value < maxValue) {
            value++;
            invalidate(xPosSlider + value*sliderStep, getHeight()/2 - SLIDER_HEIGHT/2, sliderStep, SLIDER_HEIGHT);                                  
            return true;
        }
    } else if (dx < 0) {
        if (value > 0) {
            value--;
            invalidate();
            return true;
        }
    }

    return super.navigationMovement(dx, dy, status, time);
}
1

There are 1 answers

0
Eric Giguere On BEST ANSWER

The first place to look is at your own code. Are you doing something time-consuming on the even thread that is preventing the paint operations from occurring in a timely manner? That's the likely problem.

Otherwise, you can try calling the paint method directly as shown here. But the best solution is to ensure that your event thread is not tied up doing work that should be done on a separate thread.