[android-developers] Re: EditText and Virtual Keyboard

2009-08-23 Thread Dianne Hackborn
If possible, it is better to add an appropriate watcher/filter on the text
view, and do your specialization as a result of the text being modified.
This will work for both hard keys and soft edits.

On Sun, Aug 23, 2009 at 12:05 PM, Hazam wrote:

>
> Hi guys,
> I just got back from holidays :)
> this is the hack
>
> @Override
> public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
>InputConnection ic = super.onCreateInputConnection(outAttrs);
>InputConnectionWrapper icw = new InputConnectionWrapper(ic, false) {
>
>public boolean commitText(CharSequence text, int
> newCursorPosition)
> {
>//TODO text is the new inserted text, return if the
> text is ok or
> not
>}
>};
>return icw;
> }
>
> The point is, one should use InputFilter objects on a TextField as
> much as possible,
> but in the very special case that you have to react to the key pressed
> on the vitual keyboard
> to do something more custom, that's the only way I found.
>
> Hope this helps
>
> On Aug 6, 11:09 pm, Hong  wrote:
> > Hi Emanuele,
> >
> > I'm interested in knowing your solution as well ;)  A small favor on
> > my tips to you... please...
> >
> > Thanks
> >
> > Hong
> >
> >
> >
> > On Fri, Jul 31, 2009 at 10:48 AM, Azhdar wrote:
> >
> > > Hi Hazam,
> >
> > > could you show us more in detail how you do that ?
> >
> > > Thank you !
> >
> > > Azhdar
> >
> > > On Jul 10, 3:23 pm, Hazam  wrote:
> > >> Hi Hong,
> > >> thanks for your reply.
> > >> I tried that but to no avail.
> > >> The reason seems to be that clicks and actions fromvirtualkeyboard
> > >> do not follow the same
> > >> path that normal key and touch events do.
> > >> The get tunneled in an InputConnection, and things get REALLY
> > >> difficult for me to understand fully.
> > >> So i just override onCreateInputConnection and return a
> > >> BaseInputConnection and now it works.
> > >> thanks again for the reply,
> >
> > >> -Emanuele
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: EditText and Virtual Keyboard

2009-08-23 Thread Hazam

Hi guys,
I just got back from holidays :)
this is the hack

@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
InputConnection ic = super.onCreateInputConnection(outAttrs);
InputConnectionWrapper icw = new InputConnectionWrapper(ic, false) {

public boolean commitText(CharSequence text, int 
newCursorPosition)
{
//TODO text is the new inserted text, return if the 
text is ok or
not
}
};
return icw;
}

The point is, one should use InputFilter objects on a TextField as
much as possible,
but in the very special case that you have to react to the key pressed
on the vitual keyboard
to do something more custom, that's the only way I found.

Hope this helps

On Aug 6, 11:09 pm, Hong  wrote:
> Hi Emanuele,
>
> I'm interested in knowing your solution as well ;)  A small favor on
> my tips to you... please...
>
> Thanks
>
> Hong
>
>
>
> On Fri, Jul 31, 2009 at 10:48 AM, Azhdar wrote:
>
> > Hi Hazam,
>
> > could you show us more in detail how you do that ?
>
> > Thank you !
>
> > Azhdar
>
> > On Jul 10, 3:23 pm, Hazam  wrote:
> >> Hi Hong,
> >> thanks for your reply.
> >> I tried that but to no avail.
> >> The reason seems to be that clicks and actions fromvirtualkeyboard
> >> do not follow the same
> >> path that normal key and touch events do.
> >> The get tunneled in an InputConnection, and things get REALLY
> >> difficult for me to understand fully.
> >> So i just override onCreateInputConnection and return a
> >> BaseInputConnection and now it works.
> >> thanks again for the reply,
>
> >> -Emanuele
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: EditText and Virtual Keyboard

2009-08-06 Thread Hong

Hi Emanuele,

I'm interested in knowing your solution as well ;)  A small favor on
my tips to you... please...

Thanks

Hong

On Fri, Jul 31, 2009 at 10:48 AM, Azhdar wrote:
>
> Hi Hazam,
>
> could you show us more in detail how you do that ?
>
> Thank you !
>
> Azhdar
>
>
>
> On Jul 10, 3:23 pm, Hazam  wrote:
>> Hi Hong,
>> thanks for your reply.
>> I tried that but to no avail.
>> The reason seems to be that clicks and actions fromvirtualkeyboard
>> do not follow the same
>> path that normal key and touch events do.
>> The get tunneled in an InputConnection, and things get REALLY
>> difficult for me to understand fully.
>> So i just override onCreateInputConnection and return a
>> BaseInputConnection and now it works.
>> thanks again for the reply,
>>
>> -Emanuele
>>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: EditText and Virtual Keyboard

2009-07-31 Thread Azhdar

Hi Hazam,

could you show us more in detail how you do that ?

Thank you !

Azhdar



On Jul 10, 3:23 pm, Hazam  wrote:
> Hi Hong,
> thanks for your reply.
> I tried that but to no avail.
> The reason seems to be that clicks and actions fromvirtualkeyboard
> do not follow the same
> path that normal key and touch events do.
> The get tunneled in an InputConnection, and things get REALLY
> difficult for me to understand fully.
> So i just override onCreateInputConnection and return a
> BaseInputConnection and now it works.
> thanks again for the reply,
>
> -Emanuele
>
> On Jun 30, 12:01 am, Hong  wrote:
>
> > I'm not sure if this will help 
> > you:http://developer.android.com/reference/android/widget/TextView.OnEdit...
>
> > But looks like some IME related actions you cancatch.
>
> > Please let us know if it works...
>
> > On Wed, Jun 24, 2009 at 4:36 AM, Hazam wrote:
>
> > > Folks,
> > > is there nobody having the same problem?
> > > Did I explain I clearly?
>
> > > The problem is that if i press some of thevirtualkeyboardkeys, they
> > > do not cause a onKeyDownevent;
> > > this happens with keys '/','!' and such.
>
> > > While if i press physical emulator keys, (even the same keys), they
> > > do.
> > > Could you give me some feedback on this, even a pointer to some code
> > > to study
> > > Thanks
>
> > > On 22 Giu, 20:22, Emanuele Di Saverio 
> > > wrote:
> > >> Hi all,
> > >> I was fillding with EditText and handling of events, and I was wondering 
> > >> on
> > >> a strange thing:
>
> > >> If you press some of the keys (for example forward slash '/') on the
> > >> emulated physicalkeyboard, the keyevents are called
> > >> as usual (onKeydown, the KeyListeners etc).
> > >> If I click on the correspondingvirtualkey on the onscreenvirtual
> > >>keyboard, all these callbacks do not get called at all!
> > >> This is strange, given that If I press other keys like alhpanumerical, 
> > >> the
> > >> events are called.
>
> > >> Can someone explain me this behaviour of the EditText component?
> > >> Thanks a lot
>
> > >> -Emanuele
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: EditText and Virtual Keyboard

2009-07-10 Thread Hazam

Hi Hong,
thanks for your reply.
I tried that but to no avail.
The reason seems to be that clicks and actions from virtual keyboard
do not follow the same
path that normal key and touch events do.
The get tunneled in an InputConnection, and things get REALLY
difficult for me to understand fully.
So i just override onCreateInputConnection and return a
BaseInputConnection and now it works.
thanks again for the reply,

-Emanuele

On Jun 30, 12:01 am, Hong  wrote:
> I'm not sure if this will help 
> you:http://developer.android.com/reference/android/widget/TextView.OnEdit...
>
> But looks like some IME related actions you can catch.
>
> Please let us know if it works...
>
>
>
> On Wed, Jun 24, 2009 at 4:36 AM, Hazam wrote:
>
> > Folks,
> > is there nobody having the same problem?
> > Did I explain I clearly?
>
> > The problem is that if i press some of the virtual keyboard keys, they
> > do not cause a onKeyDown event;
> > this happens with keys '/','!' and such.
>
> > While if i press physical emulator keys, (even the same keys), they
> > do.
> > Could you give me some feedback on this, even a pointer to some code
> > to study
> > Thanks
>
> > On 22 Giu, 20:22, Emanuele Di Saverio 
> > wrote:
> >> Hi all,
> >> I was fillding with EditText and handling of events, and I was wondering on
> >> a strange thing:
>
> >> If you press some of the keys (for example forward slash '/') on the
> >> emulated physical keyboard, the keyevents are called
> >> as usual (onKeydown, the KeyListeners etc).
> >> If I click on the corresponding virtual key on the onscreen virtual
> >> keyboard, all these callbacks do not get called at all!
> >> This is strange, given that If I press other keys like alhpanumerical, the
> >> events are called.
>
> >> Can someone explain me this behaviour of the EditText component?
> >> Thanks a lot
>
> >> -Emanuele
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: EditText and Virtual Keyboard

2009-06-29 Thread Hong

I'm not sure if this will help you:
http://developer.android.com/reference/android/widget/TextView.OnEditorActionListener.html

But looks like some IME related actions you can catch.

Please let us know if it works...

On Wed, Jun 24, 2009 at 4:36 AM, Hazam wrote:
>
> Folks,
> is there nobody having the same problem?
> Did I explain I clearly?
>
> The problem is that if i press some of the virtual keyboard keys, they
> do not cause a onKeyDown event;
> this happens with keys '/','!' and such.
>
> While if i press physical emulator keys, (even the same keys), they
> do.
> Could you give me some feedback on this, even a pointer to some code
> to study
> Thanks
>
> On 22 Giu, 20:22, Emanuele Di Saverio 
> wrote:
>> Hi all,
>> I was fillding with EditText and handling of events, and I was wondering on
>> a strange thing:
>>
>> If you press some of the keys (for example forward slash '/') on the
>> emulated physical keyboard, the keyevents are called
>> as usual (onKeydown, the KeyListeners etc).
>> If I click on the corresponding virtual key on the onscreen virtual
>> keyboard, all these callbacks do not get called at all!
>> This is strange, given that If I press other keys like alhpanumerical, the
>> events are called.
>>
>> Can someone explain me this behaviour of the EditText component?
>> Thanks a lot
>>
>> -Emanuele
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: EditText and Virtual Keyboard

2009-06-24 Thread Hazam

Folks,
is there nobody having the same problem?
Did I explain I clearly?

The problem is that if i press some of the virtual keyboard keys, they
do not cause a onKeyDown event;
this happens with keys '/','!' and such.

While if i press physical emulator keys, (even the same keys), they
do.
Could you give me some feedback on this, even a pointer to some code
to study
Thanks

On 22 Giu, 20:22, Emanuele Di Saverio 
wrote:
> Hi all,
> I was fillding with EditText and handling of events, and I was wondering on
> a strange thing:
>
> If you press some of the keys (for example forward slash '/') on the
> emulated physical keyboard, the keyevents are called
> as usual (onKeydown, the KeyListeners etc).
> If I click on the corresponding virtual key on the onscreen virtual
> keyboard, all these callbacks do not get called at all!
> This is strange, given that If I press other keys like alhpanumerical, the
> events are called.
>
> Can someone explain me this behaviour of the EditText component?
> Thanks a lot
>
> -Emanuele
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---