This is the answer, stupid me I put it in the wrong dialog..
On Sunday, 24 June 2012 01:17:25 UTC+8, Mystique wrote:
>
> Like this?
>
> dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
> public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
> return keyCode == KeyEvent.KEYCODE_SEARCH;
> }
> });
>
> I can seems to get it work either, pressing "search" button still dismiss
> the dialog.
>
> On Sunday, 24 June 2012 01:03:59 UTC+8, Nobu Games wrote:
>>
>> Okay, I just had a look over at Stackoverflow for that problem and
>> apparently it cannot be fixed that way under all circumstances (for
>> whatever reason, I don't know). You could however restore that dialog in
>> onResume after returning from the search dialog to your activity.
>>
>> I would also try using the debugger and step through the onKey event
>> handler method, have a look at the values that come in. Maybe
>> getRepeatCount() does not return 0. You could also just change your key
>> listener to the following:
>>
>> public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
>> return keyCode == KeyEvent.KEYCODE_SEARCH;
>> }
>>
>>
>>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en