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 8680643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:18:08+00:00 2026-06-12T21:18:08+00:00

I have a weird error that I cant figure out how to fix .

  • 0

I have a weird error that I cant figure out how to fix . I have a video player – a simple videoview that plays a video. Now I ve implemented logic so that when the user presses the back button – it tells him to press the back button again to exit, and when he does it exits.
But the problem is the first back press is not caught! I dont know what is causing this. I Press back once nothing happens, I press again and it shows me the toast that says “Please press back again to exit” and on pressing again it exits. The first one is not caught no matter what I do . This is the code for OnBackPressed()

public void onBackPressed() {
        if (doubleBackToExitPressedOnce) {
            super.onBackPressed();
            finish();
        }

        else {
            this.doubleBackToExitPressedOnce = true;
            Toast.makeText(this, "Please press the back button again to exit",
                    Toast.LENGTH_SHORT).show();
        }
    }
  • 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-06-12T21:18:09+00:00Added an answer on June 12, 2026 at 9:18 pm

    Thanks to @Satya got the answer(Commonsware) at Android back button and MediaController . Basically override dispatchKeyEvent to catch the back button press. @Satya – post your comment as an answer so I can mark it correct, marking this correct until then

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's something weird that I can't figure out. I have a Moose class that
Ok, wierd problem I cant figure out. Hopefully someone where can. I have inherited
I have a weird problem with R that I can't seem to work out.
I've got a weird problem that I can't understand... I have a simple HelloWorld
I am debugging a weird memory management error and I can’t figure it out.
So, I have this very weird error - Some advanced PHP devs might also
I am facing a weird error.I have set up my code in IntelliJ Idea.
I have come across a very weird error. I'm on Solaris 10, using Ruby
Getting this weird LINQ error. title = System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.Xml.Linq.XElement,System.String Here is the code I have:
I'm working on a bug where I have an MFC application that does weird

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.