I am making Rich Text Editor for android.like basic Rich text Editor.I want to perform basic function on toggle like BOLD the Text.I am successful with making selected text bold.but i want basic bold function like want bold button is ON next text should be in bold and when BOLD is OFF the next text should be in normal and same button can also make the selected text BOLD
Hera is my Code please Check it Currently i am doing it with basic button
message = (EditText) findViewById(R.id.note);
final Button bold = (Button) findViewById(R.id.Bold);
bold.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// message.setTypeface(message.getTypeface(), Typeface.BOLD);
int startSelection = message.getSelectionStart();
int endSelection = message.getSelectionEnd();
Spannable s = message.getText();
s.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), startSelection, endSelection, 0);
}
});
I want basic functionality which use Ms Word for BOLD then i will implement it to italic , Normal ,Underline , Color change , etc