Setting text of currently selected edit text

Put your problem here if it does not fit any of the other categories.

Setting text of currently selected edit text

Postby ramgraph1 » Mon Mar 10, 2008 8:15 am

I have a class with a few EditTexts on it. I want to add text to the EditText that is selected - where the EditText cursor is flashing - from a String variable. What code can I use to tell which EditText is selected and do a setText on THAT EditText?
Is this complicated? Any ideas?
Thanks in advance.
ramgraph1
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Wed Jan 09, 2008 10:03 pm

Top

Postby ramgraph1 » Mon Mar 10, 2008 11:28 pm

I think the key to what I need is a way to tell which EditText is focused. Does anyone know a way to do this?
Thanks.
ramgraph1
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Wed Jan 09, 2008 10:03 pm

Postby plusminus » Tue Mar 11, 2008 12:31 am

Hello ramgraph,

I'm not aware of a solution. But a dirty workaround would be to inject some keyEvents.

Tutorial: :src: here.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby ramgraph1 » Tue Mar 11, 2008 8:53 am

Thanks for responding, plusminus. Sorry, but after looking over the keyEvent tutorial, I can't figure out how that might help me. Would you be willing to expand on your suggestion a little?
ramgraph1
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Wed Jan 09, 2008 10:03 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 13 guests