onKeyUp in 2.0 gets called even when focus is in a TextView

by sdphil » Fri, 18 Dec 2009 00:39:16 GMT

Sponsored Links
 according to the documentation --

 http://developer.android.com/reference/android/app/Activity.html #onKeyUp%28int,%20android.view.KeyEvent%29

"Called when a key was released and not handled by any of the views
inside of the activity. So, for example, key presses while the cursor
is inside a TextView will not trigger the event (unless it is a
navigation to another object) because TextView handles its own key

My activity's onKeyUp should not be getting called when the cursor is
inside a TextView.  This is the behavior I see in Android 1.5 and 1.6,
but in 2.0 my activity's onKeyUp is still getting called when the
cursor is inside a TextView -- am I mis-interpreting this?



Other Threads

1. Bug using BroadcastReceivers in the App Widget Framework ?


I started to implement my own App Widget using the example provided in
the ApiDemos. In order to update the Widget efficiently I chose the
BroadcastReceiver mechanism. In the ApiDemos there is this
ExampleBroadcastReceiver which would (or should) react to changes
related to TimeZone and Time as specified in the AndroidManifest of
the ApiDemos.

I have debugged this Example using Eclipse and the Logcat output
(provoking changes in TimeZone through the settings) and come to the
conclusion that there must be some bug in the app widget framework.
The only BroadcastReceiver that seems to work is the AppWidgetProvider

For instance I would expect something like: D/ExampleBroadcastReceiver
intent=XY in the logcat's output after I have provoked the event XY.

I have even tried without the 'enabled' option in the receiver's
specification in the AndroidManifest.

BroadcastReceivers are needed to keep the update rate of my
AppWidgetProvider low and to be battery friendly. As for now my own
AppWidget Implementation that I have written has an update rate of 10
minutes which I could change to once a day if I could use the
BroadcastReceiver mechanism.

Hopefully this useful feature can be enabled somehow. Is anyone else
aware of this problem? Or maybe is there even a solution to this issue
I am experiencing? Do I have to enable the BroadcastReceiver by code
and not via the xml?


a desperate AppWidget developer

.....By the way there are some copy&paste errors in the
ExampleAppWidgetProvider: onEnabled / onDisabled; comment and code


2. Playing a .mp3 file using View Intent

Hi all,

   I want to play a mp3 file which is stored in the /sdcard/ using
ACTION_VIEW intent and I used following code to accomplish that, but I
got ActivityNotFound Exception..

Intent intent = new Intent(android.content.Intent.ACTION_VIEW);

        Uri data = Uri.parse("file:///sdcard/abc_xyz.mp3");

        try {
           } catch (ActivityNotFoundException e) {


But I got the following exception,

05-05 15:44:40.563: WARN/System.err(5253):
android.content.ActivityNotFoundException: No Activity found to handle
Intent { action=android.intent.action.VIEW data=file:///sdcard/Main
Agar Kahoon.mp3 type=/audio/mp3 }
05-05 15:44:40.582: WARN/System.err(5253):     at
05-05 15:44:40.582: WARN/System.err(5253):     at
05-05 15:44:40.593: WARN/System.err(5253):     at
05-05 15:44:40.602: WARN/System.err(5253):     at
05-05 15:44:40.602: WARN/System.err(5253):     at
05-05 15:44:40.612: WARN/System.err(5253):     at
05-05 15:44:40.612: WARN/System.err(5253):     at
05-05 15:44:40.612: WARN/System.err(5253):     at
05-05 15:44:40.612: WARN/System.err(5253):     at
05-05 15:44:40.612: WARN/System.err(5253):     at
05-05 15:44:40.612: WARN/System.err(5253):     at
05-05 15:44:40.612: WARN/System.err(5253):     at
05-05 15:44:40.612: WARN/System.err(5253):     at
05-05 15:44:40.612: WARN/System.err(5253):     at
java.lang.reflect.Method.invokeNative(Native Method)
05-05 15:44:40.612: WARN/System.err(5253):     at
05-05 15:44:40.612: WARN/System.err(5253):     at
05-05 15:44:40.612: WARN/System.err(5253):     at
05-05 15:44:40.612: WARN/System.err(5253):     at
dalvik.system.NativeStart.main(Native Method)

   In fact I used this approach to play file, because I want the
internal music application with Gui buttons on the display  during
playback. Is it possible to call the internal music application when
we play with the MediaPlayer object ??

Please help. Thanks in advance.



3. How To Set Audio Buffer In AudioTrack Class?

4. Debugger Log information on device

5. android.intent.extra.videoQuality not working for image capturing

6. onDraw() help needed....!

7. Tabs Control Code