1

I want to get a text automatically after highlighting it. But I don't want to click any button or menu..., only highlight the text. How can I do it?

Cœur
  • 34,719
  • 24
  • 185
  • 251

1 Answers1

0

Following code will highlight a textview with a bg color

 EditText edit = (EditText)findViewById(R.id.edit);
 BackgroundColorSpan span = new BackgroundColorSpan(0xFFAABBCC);
 edit.getText().setSpan(span, 0, edit.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
Sreejith B Naick
  • 1,205
  • 7
  • 12
  • i think this will help http://stackoverflow.com/questions/10188392/text-selection-listener-in-androidapi-level-7 (onselectionChanged method) – Sreejith B Naick Jul 05 '13 at 09:41
  • No, this isn't what I want to talk about. I have 2 EditText, one can input a text (etInput) and one cannot focus (etOuput). I will select some word in input text and after, it will appear in etOutput. I want to handle automatically. Sorry, I speak Eng not well :) – user2552349 Jul 07 '13 at 09:29