"Menu" button disabled when I override onKeyDown

by Mark Murphy » Mon, 19 May 2008 16:32:23 GMT


Sponsored Links
 > I am overriding onKeyDown in my activity, and calling


I'm not sure this is the problem, but you probably should return the value
of super.onKeyDown(keyCode,event); for the cases where you're not handling
the key.

Basically, if you're not handling the key, you want Android to use the
exact same behavior as if you didn't have an onKeyDown() method in the
first place. Right now, though, you're always returning true, which may or
may not be what super.onKeyDown() would return if you weren't overriding
it.

If that doesn't clear up the problem, write back!

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
The Busy Coder's Guide to Android Development -- coming in June 2008!


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Views with the same dip width number have different widths in appearance

Hello,
I have a horizontal linear layout separated with lines like the following:

 *   <View*
*      android:background="@drawable/gradient_white2"*
*      android:layout_height="fill_parent"*
*      android:layout_width="1dip"*
*    />*

In the layout editor, the lines have the same width, however, on the device
they do not - the third line in the layout below is slightly wider than the
other two. I'm wondering if there is an explanation for this or a way around
it.

Here is what the layout looks like:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:background="@drawable/customized_title_bar_button"
  android:layout_height="fill_parent"
  android:layout_width="fill_parent"
  android:orientation="horizontal"
  <ImageButton
    android:background="@drawable/customized_title_bar_button"
    android:id="@+id/home"
    android:layout_height="fill_parent"
    android:layout_width="wrap_content"
    android:src="@drawable/header_logo_small"
  />
  <LinearLayout
    android:background="@drawable/gradient_shape_blue"
    android:gravity="right|center"
    android:layout_weight="1"
    android:layout_height="fill_parent"
    android:layout_width="wrap_content"
    android:orientation="horizontal"
  >
*    <View*
*      android:background="@drawable/gradient_white2"*
*      android:layout_height="fill_parent"*
*      android:layout_width="1dip"*
*    />*
    <ImageButton
      android:background="@drawable/customized_title_bar_button"
      android:id="@+id/map"
      android:layout_height="fill_parent"
      android:layout_width="wrap_content"
      android:src="@drawable/globe_icon"
    />
 *   <View*
*      android:background="@drawable/gradient_white2"*
*      android:layout_height="fill_parent"*
*      android:layout_width="1dip"*
*    />*
    <ImageButton
      android:background="@drawable/customized_title_bar_button"
      android:id="@+id/saved"
      android:layout_height="fill_parent"
      android:layout_width="wrap_content"
      android:src="@drawable/saved_icon"
    />
 *   <View*
*      android:background="@drawable/gradient_white2"*
*      android:layout_height="fill_parent"*
*      android:layout_width="1dip"*
*    />*
    <ImageButton
      android:background="@drawable/customized_title_bar_button"
      android:id="@+id/search"
      android:layout_height="fill_parent"
      android:layout_width="wrap_content"
      android:src="@drawable/search_icon"
    />
  </LinearLayout>
</LinearLayout>

Thanks,

Mike

-- 

2. Android app creation on tablets?

Here i wanted to discuss your ideas, on how to do App development on a
tablet like the "Xoom" It has the specs to run eclipse, but is it
possible? Your thoughts/ideas?

-- 
.

3. simple image question from a noob

4. About Live Wallpaper

5. Salam Kenal dari Yudhis

6. Custom Status Bar Icons Lifecycle

7. Anggota id-Android Bandung