Thank you very much Dianne. In case anyone who needs help bumps into this, this is what I did: Inside the key down handling function I added this code: CharSequence txt = getCurrentInputConnection().getTextBeforeCursor(1000, 0); int len = txt.length(); if ( len > 1 ) { switch (arrow) { case KEY_LEFT: len--; break; case KEY_RIGHT: len++; break; case KEY_UP: case KEY_DOWN: //TBD break; } getCurrentInputConnection().setSelection(len, len); }
yakobom On Tuesday, August 14, 2012 9:14:37 AM UTC+3, Dianne Hackborn wrote: > > That sample code is interpreting these as Unicode characters which it > applies as edit operations on the text. You will need to modify the code > to do the appropriate calls to move the cursor. > > On Mon, Aug 13, 2012 at 5:59 AM, yakobom <yak...@gmail.com > <javascript:>>wrote: > >> Hi, >> I've been trying to add arrow keys to the SoftKeyboard example from the >> SDK, without success: >> Added this to the keyboard xml (qwerty.xml): >> <Row android:rowEdgeFlags="bottom"> >> <Key android:codes="21" android:keyLabel="<" >> android:isRepeatable="true" android:keyWidth="5%p" >> android:keyEdgeFlags="left"/> >> <Key android:codes="22" android:keyLabel=">" >> android:isRepeatable="true" android:keyWidth="5%p"/> >> <Key android:codes="20" android:keyLabel="\\/" >> android:isRepeatable="true" android:keyWidth="5%p"/> >> <Key android:codes="19" android:keyLabel="/\\" >> android:isRepeatable="true" android:keyWidth="5%p" >> android:keyEdgeFlags="right"/> >> </Row> >> >> I get the extra keys, but when I click them I get squares. >> Can anyone tell why? >> >> I googled for it but could not find any answer, this seem to be correct - >> but does not work. >> >> Thanks, >> yakobom >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to >> android-d...@googlegroups.com<javascript:> >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > > > -- > Dianne Hackborn > Android framework engineer > hac...@android.com <javascript:> > > 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