I'm currently drawing a map that contains hexagons as it's nodes I made a NodeView class to have the image drawn on a Canvas when called. (you can see this image to see the hexagon layout) Every node has it's own NodeView (since each of them have other properties)
What I want to do is when a hexagon is touched (on ActionUp) it will redraw it's image to be a different hexagon image
so far this is what I have
public boolean onTouchEvent(MotionEvent event) {
int eventaction = event.getAction();
switch (eventaction) {
case MotionEvent.ACTION_DOWN:
// finger touches the screen
break;
case MotionEvent.ACTION_MOVE:
// finger moves on the screen
break;
case MotionEvent.ACTION_UP:
// finger leaves the screen
Toast toast = Toast.makeText(getContext(), "Button is pressed", 1);
toast.show();
//should change the image drawn on this view ONLY
break;
}
return true;
}
How should I go about to have on ACTION_UP make the touched hexagon to change it's image only?
Currently when the NodeView is used it uses the onDraw() method to draw the hexagon depending on which one was supposed to be drawn (I have several for different terrains).