onKeyDown() functionality issue

by Kshitij Aggarwal » Fri, 22 Jan 2010 18:46:27 GMT

Sponsored Links

I was trying to override the back button functionality where I wanted
to call the default functionality in case a boolean is set false

public boolean onKeyDown(int keyCode, KeyEvent event) {
        boolean temp = false;
        if (event.KEYCODE_BACK == keyCode) {
            System.out.println("Back pressed");
            if (isTrue) {
                //Do something
                return true;
            else return false;
        return false;

Now this doesn't exactly work how the documentation states. the //Do
Something part is executed well, but when isTrue is false i want the
default back functionality which is not happening. Im using SDK 1.5


   1.      How do I fix this?
   2.      Is this issue fixed in later SDK updates? If not can
someone raise a bug for the same?


onKeyDown() functionality issue

by Marek Uhel » Sat, 23 Jan 2010 02:59:27 GMT

 Try to call return super.onKeyDown(keyCode, event)


Sponsored Links

Other Threads

1. Getting the Model Number field

In Settings > About phone there is a field Model Number which now
obviously says "T-Mobile G1". But to already be device-independent for
the future, is there a way in the SDK to get this field. I will not be
using it to identify the device but simply to form a string that says
"I am running Android on my [Model Number]"


2. Taking Camera Pictures in app

Still trying to figure this out, but not getting anywhere on it.

Does taking a picture using the camera only require creating the
Camera.PictureCallback for onPictureTaken() and passing it into
Camera.takePicture() as an input?  Or do you have to stop the preview,
lock the canvas, and convert/extract data from there to get it into a
writable form?

I'm fine with the first one, but completely confused as to how to do
the latter.

Also, is taking pictures in the emulator functional or not?  I tried
to run CameraApiTest and it crashes hard whenever I hit spacebar, even
though I have an SD card instantiated.

3. why would android call oncreate when flipping the keyboard

4. install application from sdcard, how?!

5. chmod unexpected permission error when logged into an actual device

6. Viewing Market Comments

7. Suggestion