Skip to content Skip to sidebar Skip to footer

Execute The Code Inside Ondraw() Only After The Click In View

I have a class that extends a view. This class is called in xml to build my view. Now the view call the onDraw automatically the onDraw function on loaded. But how i can do what i

Solution 1:

Try overriding the

public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
// your actions here
}
}

then call invalidate() function, which will set a flag to call the onDraw() of your view.

Post a Comment for "Execute The Code Inside Ondraw() Only After The Click In View"