Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6671235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:21:50+00:00 2026-05-26T03:21:50+00:00

I have an an activity called GameViewUI. In this activity I have this method:

  • 0

I have an an activity called GameViewUI. In this activity I have this method:

int DIALOG_GAMEOVER_ID = 1;

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_GAMEOVER_ID:
        Context mContext = this;
        Dialog dialog = new Dialog(mContext);

        dialog.setContentView(R.layout.gameoverdialog);
        dialog.setTitle("GAME OVER");

        TextView text = (TextView) dialog
                .findViewById(R.id.pointsGameOverTextView);
        text.setText("Points: " + currentScore);
        // Get buttons and add listeners
        Button playAgainButton = (Button) dialog
                .findViewById(R.id.playAgainButton);
        Button goToMainMenuButton = (Button) dialog
                .findViewById(R.id.goToMainMenuButton);

        playAgainButton.setOnTouchListener(this);
        goToMainMenuButton.setOnTouchListener(this);

        return dialog;
    }
    return super.onCreateDialog(id);

}

As well as this one:

public boolean onTouch(View view, MotionEvent event) {
    if (view.equals((Button) findViewById(R.id.goToMainMenuButton))) {
        Intent myIntent = new Intent(view.getContext(), MainUI.class);
        startActivity(myIntent);
        return true;
}

}

The dialog “pops up” when this code launch:

 showDialog(1);

The dialog pops up, and I can see the buttons. But they aren’t clickable! I can’t click them.

What do I do wrong?

I want to click the buttons and get to the other activity.

Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:21:51+00:00Added an answer on May 26, 2026 at 3:21 am

    Maybe, you can change the logic. As long as it is an Alert Dialog you can try this and declare everything you need in an Alert method. This works for me.

    private AlertDialog.Builder builder;
         private void showAlert(int id){
                switch (id) {
                case DIALOG_GAMEOVER_ID:
                        builder.setMessage("GAME OVER")
                        .setCancelable(false)
                        .setPositiveButton("Go To Main", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int id) {
                            Intent myIntent = new Intent(view.getContext(),MainUI.class);
                            startActivity(myIntent);
    
    
                            }
                        }).setNegativeButton("Play Again", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int id) {
                            Intent myIntent = new Intent(view.getContext(),Custom.class);
                            startActivity(myIntent);
    
    
                            }
                        });
    
                        builder.create();
                        builder.show();
                        break;
                  }
    
             }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a main Activity called Main which has onActivityResult Method. protected void onActivityResult(int
I have a Activity called main. If I call Toast.makeText(this, Hello World from main,
I have this menu example But in this example new activity is not called,
I have a method updateFoo() of an activity called both from a Handler thread
i have an activity called wipeScreen.java this activity runs a wipeService.java for wiping a
Going round in circles here i think. I have an activity called Locate; public
I have a list of objects called Activity: class Activity { public Date activityDate;
I have Activity with ListView inside it and in the onCreate method of the
I have an activity that launches another activity with startActivityForResult method. I would like
I have an activity called A, and on the selection of menu item 0,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.