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
presses."

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?

tia.

--



Other Threads

1. Bug using BroadcastReceivers in the App Widget Framework ?

Hi!

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
itself.

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?

Cheers,

a desperate AppWidget developer

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

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

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");
        intent.setDataAndType(data,"/audio/mp3");

        try {
                  startActivity(intent);
           } catch (ActivityNotFoundException e) {
                  e.printStackTrace();


           }

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
android.app.Instrumentation.checkStartActivityResult
(Instrumentation.java:1471)
05-05 15:44:40.582: WARN/System.err(5253):     at
android.app.Instrumentation.execStartActivity(Instrumentation.java:
1441)
05-05 15:44:40.593: WARN/System.err(5253):     at
android.app.Activity.startActivityForResult(Activity.java:2526)
05-05 15:44:40.602: WARN/System.err(5253):     at
android.app.Activity.startActivity(Activity.java:2570)
05-05 15:44:40.602: WARN/System.err(5253):     at
test.mp3file.MusicTest.onCreate(MusicTest.java:25)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1122)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2104)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2157)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1581)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.os.Handler.dispatchMessage(Handler.java:88)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.os.Looper.loop(Looper.java:123)
05-05 15:44:40.612: WARN/System.err(5253):     at
android.app.ActivityThread.main(ActivityThread.java:3739)
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
java.lang.reflect.Method.invoke(Method.java:515)
05-05 15:44:40.612: WARN/System.err(5253):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:739)
05-05 15:44:40.612: WARN/System.err(5253):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
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.

Asif

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

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