Does EditText(or other View)supported LinkButton in its text

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

Does EditText(or other View)supported LinkButton in its text

Postby tsdt » Thu Jan 10, 2008 8:19 pm

I am writing a Dictionary app with 1 AutoCompleteText for typing word and 1 EditText to display the meaning of queried words:
1.The first problem is i do not know how to pick one token in the text of EditText when i move the mouse pointer to that token.
2.The second problem is when i click on that token i want some action 'll be happened,what should i do now?
LE CANH TOAN
(thnx for reading my problem!)
TSDT
tsdt
Junior Developer
Junior Developer
 
Posts: 12
Joined: Wed Jan 09, 2008 4:20 am
Location: VIETNAM

Top

Re: Does EditText(or other View)supported LinkButton in its

Postby plusminus » Thu Jan 10, 2008 8:59 pm

tsdt wrote:I am writing a Dictionary app with 1 AutoCompleteText for typing word and 1 EditText to display the meaning of queried words:
1.The first problem is i do not know how to pick one token in the text of EditText when i move the mouse pointer to that token.
2.The second problem is when i click on that token i want some action 'll be happened,what should i do now?
LE CANH TOAN
(thnx for reading my problem!)


Hello tsdt,

remember that your application will run on a Mobile Phone :!: so you do not really have a MousePointer and hovering sth in an EditText with my (not that small) fingers is probably not that easy :roll:

I'm not 100% sure, but if you set an OnClickListener to the EditText, its onClick method should get called every time you 'hit' somewhere in your EditBox. The Caret will jump to the position you clicked.

Probably code like this helps:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         keyWordEditText.setOnClickListener(new OnClickListener(){
  2.                 @Override
  3.                 public void onClick(View clickedView) {
  4.                         int selStart = ((EditText)clickedView).getSelectionStart();
  5.                         // Determine the word "under" selStart...
  6.                 }
  7.         });
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


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

Top

Return to Other Coding-Problems

Who is online

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