Skip to content Skip to sidebar Skip to footer

Android - Game Thread And Dialogs

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

Solution 1:

you can pass the context from parent activity

for example

showLongMessage(myclass.this, returnMsg);

and this is the showLongMessage method...

public static void showLongMessage(Context ctxtform, CharSequence message) {
    new AlertDialog.Builder(ctxtform)

    .setTitle(Modules.AgentName)

    .setMessage(message)

    .setIcon(R.drawable.icon_alert)

    .setPositiveButton("OK", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int whichButton)

        {

        }
    }).show();
}

Post a Comment for "Android - Game Thread And Dialogs"