Skip to content Skip to sidebar Skip to footer

Button Only Clickable Once With Custom View

i made custom Image View, where a simple line is drawn. This drawing is triggeed by a button. When triggered the onClicklistener isnt working anymore. But on the screen the button

Solution 1:

i think i found the problem: when you start the handler.run() you set a new Layout:

publicvoidrun() {
    int coordX = ((((endX - startX) / frames) * number))  + startX;
    int coordY = ((((endY - startY) / frames) * number))  + startY;
    number += 1;
    CustomDraw.setCoordinates(startX, startY, coordX, coordY);

    //maybe this is wrongsetContentView(R.layout.activity_main);

    //try instead:CustomDraw.invalidate();

    if ((coordX - endX) == 0 && coordY - endY == 0) {
        Running = false;
    }
}

i don't get why you set a new layout... i guess you want to repaint the button... that's why i added a 'repaint'-line in that code-piece above

Post a Comment for "Button Only Clickable Once With Custom View"