Hi Balwinder, That is pretty much what I'm doing. I'm running 1.6. I guess it's working for me as well that way, but why do I have to hit the back button on the emulator for the text to be copied? On a real device this would be kind of frustrating.
On Sep 24, 8:52 am, "Balwinder Kaur (T-Mobile USA)" <balwinder.k...@t- mobile.com> wrote: > Another thought. How are you copying and pasting from A to B ? > I was able to do it using this snippet. > > CharSequence c = ((EditText)v).getText(); > edittext2.setText(c); > > Balwinder Kaur > ·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, 9:54 pm, "Balwinder Kaur (T-Mobile USA)" <balwinder.k...@t- > > mobile.com> wrote: > > hmm..I don't know what is going in your environment. For me (using SDK > > 1.5) Your code as is, works too. When I hit the back button on the > > emulator, the virtual keyboard exits, HELLO gets copied to the > > EditTextA. > > > Balwinder Kaur > > ·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, 1:10 pm, Android_n00b <nikhil...@gmail.com> wrote: > > > > I apologize about the last part of that message. I meant that I read > > > online about KeyboardView.OnKeyboardActionListener, but do not know > > > how it works. > > > > On Sep 23, 4:08 pm, Android_n00b <nikhil...@gmail.com> wrote: > > > > > 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 <nikhil...@gmail.com> 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 android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---