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

  • Home
  • SEARCH
  • 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 7700751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:49:14+00:00 2026-05-31T22:49:14+00:00

I need to capture the event when my app is showing a dialog and

  • 0

I need to capture the event when my app is showing a dialog and i press the device’s back button.

Well it is not definetly a dialog. It is a dropdown list for my spinner.

I tryed:

public boolean onKeyDown(int keyCode, KeyEvent event) 
{
    if (keyCode == KeyEvent.KEYCODE_BACK)
    {

    Toast myToast = Toast.makeText(getApplicationContext(), "back putton pressed", 1);
    myToast.show();

    }

    // Call super code so we dont limit default interaction
    super.onKeyDown(keyCode, event);

    return true;
}

Not worked.

I also tryed:

public void onBackPressed()
{


    Toast myToast = Toast.makeText(getApplicationContext(), "back putton pressed", 1);
    myToast.show();

}

I even tryed this with overriding.
So none of the above sollutions are worked for me. I found both of these on stackoverflow but for some reason they are not working for me.
Of course they work when there is now dialog showing, but when do… they are not run.

Any ideas ?

So my

  • 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-31T22:49:15+00:00Added an answer on May 31, 2026 at 10:49 pm

    Try

     if (keyCode == KeyEvent.KEYCODE_BACK)
    {
    
        Toast myToast = Toast.makeText(getApplicationContext(), "back putton pressed", 1);
       myToast.show();
        return true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to capture right mouse click event inside a iframe in asp.net using
I need to capture keystokes from a wedge device and prevent any controls or
We have a need to capture signatures from an iOS app – the use
I need to capture the 'Update' click event with jQuery in an asp.net GridView
I need to capture when the Page_SizeChanged event fires in a WPF Browser application
I need to capture the event raised when a flash video ends. If possible,
I need to capture a tab keypress event on some dynamic inputs, but the
I need to capture the KeyUp event in my form (to toggle a full
I need to capture the value of a specific field in the CurrentChange event.
I am using jquery mobile datepicker, i need to capture the calendar click event,

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.