Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Android
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Eclipse Collections Categorically: Level up your programming game
this week in the
Open Source Projects
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Android
Edittext cursor position
asha Pawaskar
Greenhorn
Posts: 7
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi
How to get the cursor position in the editText and how to add a character at that position?
I have tried with Selection class but no use because it has methods like getSelectionStart() and getSelectionEnd().
I want to get the position of the cursor?
Ankit Garg
Sheriff
Posts: 9709
43
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
If there is no selection, both getSelectionStart and getSelectionEnd return the position of the cursor in the EditText. To insert something at the current cursor position, use
tf.getText().insert(tf.getSelectionStart(), "whatever");
SCJP 6 | SCWCD 5 |
Javaranch SCJP FAQ
|
SCWCD Links
asha Pawaskar
Greenhorn
Posts: 7
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi Ankit
Thanks, it's working.
It sure was nice of your sister to lend us her car. Let's show our appreciation by sharing this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Text Area Problem... Pls Help
JTextPane
retrieve value from edittext from ListView
regarding layout
Remove focus
More...