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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:35:50+00:00 2026-05-24T15:35:50+00:00

Whilst drawing on a SurfaceView, I’m having a problem intercepting a ‘back’ key press.

  • 0

Whilst drawing on a SurfaceView, I’m having a problem intercepting a ‘back’ key press. My onKeyDown event only seems to get called on the 2nd and subsequent key events – which is useless for the back key because by the activity has already paused or terminated.

I have tried every suggestion I have come across, making sure focusable and touchmodefocusable are set etc, moving my onkeydown handler out of the View and into the activity etc. It works the same on the emulator and on hardware.

I know this has something to do with focus, but it seems I cant get my surfaceview to recieve focus for Key Events and Touch Events at the same time.

Please help I am getting seriously miffed with this as I cant understand why no one else has this problem.

Thanks.

  • 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-24T15:35:50+00:00Added an answer on May 24, 2026 at 3:35 pm

    Solved this – for some reason using a requestFocus() call ‘before’ setting the setFocusable(true) flags did the trick. whodathunkit. btw this is done in the surface view constructor.

    Copied this to an answer in case it helps anyone else.

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

Sidebar

Related Questions

Whilst that title is a slight lie it defines the problem. I have an
Whilst researching data structures for a project a few months back, I came across
I came across an interesting problem today whilst implementing a feature into a dynamic
Im having an issue whilst loading images into a UITableViewCell after an asynchronous download
I had a problem a while ago whilst using Solaris that I wanted to
Yet another problem whilst trying to create the UI for an app. I've got
Whilst analysing some legacy code with FXCop, it occurred to me is it really
Whilst starting to learn lisp, I've come across the term tail-recursive . What does
Whilst refactoring some old code I realised that a particular header file was full
Whilst working on a recent project, I was visited by a customer QA representitive,

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.