I have a Android game w/ a ViewThread and a Panel that uses the onTouchEvent. What's the best way to call the parent Activity's 'showDialog' method when the Panel's onTouchEvent is fired and to communicate the resulting information back to the underlying code?
For example in my Panel I have the following:
@Override
public boolean onTouchEvent(MotionEvent event) {
int todo = map.click(event.getX(), event.getY());
//If a valid square was clicked, lets popup a dialog
if(todo == 1){
//Activity.showDialog(1); -- Callback method or 'event' I can use to trigger?
//map.updateWithDialogChoice(DialogResult) // How to access result from Dialog
}
return super.onTouchEvent(event);
}
I'm slightly confused on the proper way to funnel information back and forth between these kind of actions.
Thanks!
you can pass the context from parent activity
for example
and this is the showLongMessage method...