Thanks for the reply. If I type HELLO and hit the back button, only O
gets copied into box B. It's weird. Here is the relevant part of my
code:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.virtualkeyboard);
final EditText boxA= (EditText) findViewById(R.id.boxA);
final EditText boxB= (EditText) findViewById(R.id.boxB);
boxA.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent
event) {
// TODO Auto-generated method stub
if(event.getAction() == KeyEvent.ACTION_UP)
{
//copy text from box A to B
}
return false;
}
});
Now just to repeat my problem, the above code works perfectly when I
use a physical keyboard, or the emulators hard keyboard. It is only
when I use the virtual(soft) keyboard does it not work. I saw some
posts online about using setOnKeyListener instead. But I do not know
how that works since it is not a method for EditText.
On Sep 23, 3:54 pm, "Balwinder Kaur (T-Mobile USA)" <balwinder.k...@t-
mobile.com> wrote:
> Did you try hitting the backbutton on the emulator ( that would remove
> virtual keyboard) and see if EditBox B gets updated or not ? I think
> it should.
>
> If not, please past your code here, so folks can take a look at it.
>
> Thanks,
> Balwinder Kaur
> Open Source Development Center
> ·T· · ·Mobile· stick together
>
> The views, opinions and statements in this email are those of the
> author solely in their individual capacity, and do not necessarily
> represent those of T-Mobile USA, Inc.
>
> On Sep 23, 11:13 am, Android_n00b <[email protected]> wrote:
>
> > Hi,
> > I am new to Android, and am writing an app which has 2 EditTexts
> > (Let's call them A and B) and whenever I hit any key in A, it is
> > automatically copied to B. For example, if I type HELLO in A, it will
> > copy each letter into B. I managed to get this to work perfectly with
> > the setOnKeyListener(). However, in the emulator I found that the
> > virtual keyboard did not respond to this listener the same way. For
> > some weird reason, the number keys in the Virtual Keyboard (0-9)
> > responded to the onKeyListener but none of the others did. After doing
> > a Google search of my issue, I found some people with similar
> > problems, but no real solution. I realized there is a
> > KeyboardView.OnKeyboardActionListener which listens for inputs from
> > the virtual keyboard. However, I have no idea how to use this in my
> > edittext field. I would appreciate some sort of help with this matter.
>
> > Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---