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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:15:43+00:00 2026-06-10T16:15:43+00:00

I have an app: 3D Cube (OPENGLES) with touch and key support. I’m using

  • 0

I have an app:
3D Cube (OPENGLES) with touch and key support. I’m using KEYCODE_VOLUME_UP/DOWN to zoom in/out. Method responsible for that is placed in:
MyGLSurfaceView extends GLSurfaceView. My problem is, when I press the zoom out/int, it works fine, but I have also volume up/down function. Is possible quick solution for that?

code:

       @Override
   public boolean onKeyUp(int keyCode, KeyEvent evt) {
      switch(keyCode) {
         case KeyEvent.KEYCODE_DPAD_LEFT:   // Decrease Y-rotational speed
            renderer.speedY -= 0.3f;
            break;
         case KeyEvent.KEYCODE_DPAD_RIGHT:  // Increase Y-rotational speed
            renderer.speedY += 0.3f;
            break;
         case KeyEvent.KEYCODE_DPAD_UP:     // Decrease X-rotational speed
            renderer.speedX -= 0.3f;
            break;
         case KeyEvent.KEYCODE_DPAD_DOWN:   // Increase X-rotational speed 
            renderer.speedX += 0.3f;
            break;
         case KeyEvent.KEYCODE_VOLUME_DOWN:// Zoom out (decrease z)
            renderer.z -= 0.4f;
            break;
         case KeyEvent.KEYCODE_VOLUME_UP: // Zoom in (increase z)
            renderer.z += 0.4f;
            break;
         case KeyEvent.KEYCODE_DPAD_CENTER:
             renderer.speedY = 0;
             renderer.speedX = 0;
             renderer.z      = -6.0f;
             break;
      }
      return true;
   }
  • 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-10T16:15:44+00:00Added an answer on June 10, 2026 at 4:15 pm

    The system volume control is performed by the onKeyDown event. Returning true in your class cancels the onKeyUp event from being processed by the system but the onKeyDown has already been run. Override onKeyDown instead and it should work.

    EDIT: After some research it seems that the best approach to override dispatchKeyEvent which should prevent both the onKeyDown and onKeyUp events.

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

Sidebar

Related Questions

we have app hosted on google app engine for java. In this app we
I have app.config in m win application, and loggingConfiguration section (enterprise library 4.1). I
We have App A as main app. Now we build from it App B
I have app in which i have recorded sound files i want that i
lets say i have app id, app secret id and user uid now i
for example: I have app A, which references library A and library B. in
have an app that finds your GPS location successfully, but I need to be
Have an app that has listings - think classified ads - and each listing
My app have a background image that fills the screen. I'd like to display
my app have action bar on top of windows. Where are some buttons. Buttons

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.