Now I am writing simple note app. And i need to display formatted separate selected text in EditText.
I tried,
EditText et = (EditText)findViewById(R.id.edittext);
String string;
int startSelection = et.getSelectionStart();
int endSelection = et.getSelectionEnd();
string = et.getText().toString();
string.substring(startSelection, endSelection);
Spanned s = Html.fromHtml("<font color=\"red\">" + string + "</font>");
et.setText(s);
This solution displays only separate selected text. But i need to display formatted text among other text. I have no idea.
UPD: Formatting happening, when user clicks on the button.
try using this
If you talking about formatting the Text, You can always do like this
And If you want to
linkify
a specific part of the Text then do it like this using this BlogTry this