bold and italics in edittext











up vote
-1
down vote

favorite












In the edit text, the user should select whether what they type should be bold or italics or normal. In my case when a user selects bold the entire edit text changes to bold and if he again selects italics the entire edit text becomes italics. When the user selects bold types something, it should be bold and when he selects italics or normal the words that he types after that should be italics or normal, not the previous one which is bold. also when I print the input in edit text it is printed as normal even it is given as bold.



I have my code at the bottom



<EditText
android:id="@+id/check_edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="check"
/>


this is where I have set the edit text to bold or italics



bold.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editCheck.setTypeface(editCheck.getTypeface(), Typeface.BOLD);
}
});
italics.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editCheck.setTypeface(editCheck.getTypeface(), Typeface.ITALIC);
}
});
normal.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editCheck.setTypeface(editCheck.getTypeface(), Typeface.NORMAL);
}
});
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
result.setText(editCheck.getText().toString());
}
});


How can I implement this










share|improve this question
























  • And what is exactly your problem? As I have seen in your code when you do the setText to the result it is printing as normal. When you change the typeface it is changing eventhough you have written text?
    – Brank Victoria
    Nov 21 at 14:20










  • when I click bold entire text changes, even text that I have typed before,I want the text typed after selecting bold should only become bold. And in the result it should be printed as it typed in the edittext. In my code I didnt know how to implement that.
    – Siva perumal
    Nov 21 at 14:29












  • This when I click bold entire text changes do you mean that changes to bold? Or another text?
    – Brank Victoria
    Nov 21 at 14:30










  • every word in the edittext changes to bold, but what I want is only the text that I start typing after the bold button is clicked should be bold.
    – Siva perumal
    Nov 21 at 14:31

















up vote
-1
down vote

favorite












In the edit text, the user should select whether what they type should be bold or italics or normal. In my case when a user selects bold the entire edit text changes to bold and if he again selects italics the entire edit text becomes italics. When the user selects bold types something, it should be bold and when he selects italics or normal the words that he types after that should be italics or normal, not the previous one which is bold. also when I print the input in edit text it is printed as normal even it is given as bold.



I have my code at the bottom



<EditText
android:id="@+id/check_edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="check"
/>


this is where I have set the edit text to bold or italics



bold.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editCheck.setTypeface(editCheck.getTypeface(), Typeface.BOLD);
}
});
italics.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editCheck.setTypeface(editCheck.getTypeface(), Typeface.ITALIC);
}
});
normal.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editCheck.setTypeface(editCheck.getTypeface(), Typeface.NORMAL);
}
});
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
result.setText(editCheck.getText().toString());
}
});


How can I implement this










share|improve this question
























  • And what is exactly your problem? As I have seen in your code when you do the setText to the result it is printing as normal. When you change the typeface it is changing eventhough you have written text?
    – Brank Victoria
    Nov 21 at 14:20










  • when I click bold entire text changes, even text that I have typed before,I want the text typed after selecting bold should only become bold. And in the result it should be printed as it typed in the edittext. In my code I didnt know how to implement that.
    – Siva perumal
    Nov 21 at 14:29












  • This when I click bold entire text changes do you mean that changes to bold? Or another text?
    – Brank Victoria
    Nov 21 at 14:30










  • every word in the edittext changes to bold, but what I want is only the text that I start typing after the bold button is clicked should be bold.
    – Siva perumal
    Nov 21 at 14:31















up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











In the edit text, the user should select whether what they type should be bold or italics or normal. In my case when a user selects bold the entire edit text changes to bold and if he again selects italics the entire edit text becomes italics. When the user selects bold types something, it should be bold and when he selects italics or normal the words that he types after that should be italics or normal, not the previous one which is bold. also when I print the input in edit text it is printed as normal even it is given as bold.



I have my code at the bottom



<EditText
android:id="@+id/check_edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="check"
/>


this is where I have set the edit text to bold or italics



bold.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editCheck.setTypeface(editCheck.getTypeface(), Typeface.BOLD);
}
});
italics.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editCheck.setTypeface(editCheck.getTypeface(), Typeface.ITALIC);
}
});
normal.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editCheck.setTypeface(editCheck.getTypeface(), Typeface.NORMAL);
}
});
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
result.setText(editCheck.getText().toString());
}
});


How can I implement this










share|improve this question















In the edit text, the user should select whether what they type should be bold or italics or normal. In my case when a user selects bold the entire edit text changes to bold and if he again selects italics the entire edit text becomes italics. When the user selects bold types something, it should be bold and when he selects italics or normal the words that he types after that should be italics or normal, not the previous one which is bold. also when I print the input in edit text it is printed as normal even it is given as bold.



I have my code at the bottom



<EditText
android:id="@+id/check_edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="check"
/>


this is where I have set the edit text to bold or italics



bold.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editCheck.setTypeface(editCheck.getTypeface(), Typeface.BOLD);
}
});
italics.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editCheck.setTypeface(editCheck.getTypeface(), Typeface.ITALIC);
}
});
normal.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editCheck.setTypeface(editCheck.getTypeface(), Typeface.NORMAL);
}
});
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
result.setText(editCheck.getText().toString());
}
});


How can I implement this







java android xml






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 14:37









Eren ÇELİK

354




354










asked Nov 21 at 14:16









Siva perumal

275




275












  • And what is exactly your problem? As I have seen in your code when you do the setText to the result it is printing as normal. When you change the typeface it is changing eventhough you have written text?
    – Brank Victoria
    Nov 21 at 14:20










  • when I click bold entire text changes, even text that I have typed before,I want the text typed after selecting bold should only become bold. And in the result it should be printed as it typed in the edittext. In my code I didnt know how to implement that.
    – Siva perumal
    Nov 21 at 14:29












  • This when I click bold entire text changes do you mean that changes to bold? Or another text?
    – Brank Victoria
    Nov 21 at 14:30










  • every word in the edittext changes to bold, but what I want is only the text that I start typing after the bold button is clicked should be bold.
    – Siva perumal
    Nov 21 at 14:31




















  • And what is exactly your problem? As I have seen in your code when you do the setText to the result it is printing as normal. When you change the typeface it is changing eventhough you have written text?
    – Brank Victoria
    Nov 21 at 14:20










  • when I click bold entire text changes, even text that I have typed before,I want the text typed after selecting bold should only become bold. And in the result it should be printed as it typed in the edittext. In my code I didnt know how to implement that.
    – Siva perumal
    Nov 21 at 14:29












  • This when I click bold entire text changes do you mean that changes to bold? Or another text?
    – Brank Victoria
    Nov 21 at 14:30










  • every word in the edittext changes to bold, but what I want is only the text that I start typing after the bold button is clicked should be bold.
    – Siva perumal
    Nov 21 at 14:31


















And what is exactly your problem? As I have seen in your code when you do the setText to the result it is printing as normal. When you change the typeface it is changing eventhough you have written text?
– Brank Victoria
Nov 21 at 14:20




And what is exactly your problem? As I have seen in your code when you do the setText to the result it is printing as normal. When you change the typeface it is changing eventhough you have written text?
– Brank Victoria
Nov 21 at 14:20












when I click bold entire text changes, even text that I have typed before,I want the text typed after selecting bold should only become bold. And in the result it should be printed as it typed in the edittext. In my code I didnt know how to implement that.
– Siva perumal
Nov 21 at 14:29






when I click bold entire text changes, even text that I have typed before,I want the text typed after selecting bold should only become bold. And in the result it should be printed as it typed in the edittext. In my code I didnt know how to implement that.
– Siva perumal
Nov 21 at 14:29














This when I click bold entire text changes do you mean that changes to bold? Or another text?
– Brank Victoria
Nov 21 at 14:30




This when I click bold entire text changes do you mean that changes to bold? Or another text?
– Brank Victoria
Nov 21 at 14:30












every word in the edittext changes to bold, but what I want is only the text that I start typing after the bold button is clicked should be bold.
– Siva perumal
Nov 21 at 14:31






every word in the edittext changes to bold, but what I want is only the text that I start typing after the bold button is clicked should be bold.
– Siva perumal
Nov 21 at 14:31














1 Answer
1






active

oldest

votes

















up vote
1
down vote













If you want different font styles in your text view you can set it from HTML. Take a look to this post:



Is it possible to have multiple styles inside a TextView?



So in your case you can save the text entered in HTML format depending on what the user clicked to put <b> for bold, <i> for italics and so.



This will also help you to print it in the result textView, because you will print it from the HTML.



EDIT: For solve the problem that all your text is getting bold or italic, you must edit your onclick events to know the type of what you are writing. And also use TextWatcher to know what is the inserted text. For example:



int typeFaceSelected = Typeface.NORMAL //private global var with NORMAL as default value
String resultedText = ""; //private global var, this will give to your textview the result of the edittext in HTML
bold.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.BOLD
}
});
italics.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.ITALIC
}
});
normal.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.NORMAL
}
});

//You can edit the text you add
editCheck.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {}

public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

public void onTextChanged(CharSequence s, int start, int before, int count) {
String sAux = s.toString().subString(start, start + count);

switch(typeFaceSelected)
{
case Typeface.NORMAL:
resultedText = sAux;
break;
case Typeface.ITALIC:
resultedText = "<i>" + sAux + "</i>";
break;
case Typeface.BOLD:
resultedText = "<b>" + sAux + "</b>";
break;
}
editCheck.setText(Html.fromHtml(resultedText));
}
});

button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
result.setText(HTML.fromHTML(resultedText));
}
});


The above code was based on this Differences between TextWatcher 's onTextChanged, beforeTextChanged and afterTextChanged



Also, I haven't test it so I'm not sure if its working or not, but at least I think it is enough to get the idea.






share|improve this answer























  • even when I use html and the bold button is clicked, even the previously typed words are changed to bold. actually what I want is only when the user selects bold it should be bold from that word and not the previous word.
    – Siva perumal
    Nov 21 at 15:26










  • I know what you're saying, but in this case. You must change your code. This means that you have to change the logic inside your onclick events. Let me edit my answer so it would be clearer for you
    – Brank Victoria
    Nov 21 at 15:55










  • ok even I thought that would be the mistake but the logic is what I am not getting.
    – Siva perumal
    Nov 21 at 16:14










  • @Sivaperumal take a look to the edition of the answer so you can understand what I am talking about.
    – Brank Victoria
    Nov 21 at 16:32










  • it didnt work but yes it gave me an idea of how to do this, thanks. I will try it
    – Siva perumal
    Nov 23 at 13:13













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53414053%2fbold-and-italics-in-edittext%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













If you want different font styles in your text view you can set it from HTML. Take a look to this post:



Is it possible to have multiple styles inside a TextView?



So in your case you can save the text entered in HTML format depending on what the user clicked to put <b> for bold, <i> for italics and so.



This will also help you to print it in the result textView, because you will print it from the HTML.



EDIT: For solve the problem that all your text is getting bold or italic, you must edit your onclick events to know the type of what you are writing. And also use TextWatcher to know what is the inserted text. For example:



int typeFaceSelected = Typeface.NORMAL //private global var with NORMAL as default value
String resultedText = ""; //private global var, this will give to your textview the result of the edittext in HTML
bold.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.BOLD
}
});
italics.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.ITALIC
}
});
normal.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.NORMAL
}
});

//You can edit the text you add
editCheck.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {}

public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

public void onTextChanged(CharSequence s, int start, int before, int count) {
String sAux = s.toString().subString(start, start + count);

switch(typeFaceSelected)
{
case Typeface.NORMAL:
resultedText = sAux;
break;
case Typeface.ITALIC:
resultedText = "<i>" + sAux + "</i>";
break;
case Typeface.BOLD:
resultedText = "<b>" + sAux + "</b>";
break;
}
editCheck.setText(Html.fromHtml(resultedText));
}
});

button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
result.setText(HTML.fromHTML(resultedText));
}
});


The above code was based on this Differences between TextWatcher 's onTextChanged, beforeTextChanged and afterTextChanged



Also, I haven't test it so I'm not sure if its working or not, but at least I think it is enough to get the idea.






share|improve this answer























  • even when I use html and the bold button is clicked, even the previously typed words are changed to bold. actually what I want is only when the user selects bold it should be bold from that word and not the previous word.
    – Siva perumal
    Nov 21 at 15:26










  • I know what you're saying, but in this case. You must change your code. This means that you have to change the logic inside your onclick events. Let me edit my answer so it would be clearer for you
    – Brank Victoria
    Nov 21 at 15:55










  • ok even I thought that would be the mistake but the logic is what I am not getting.
    – Siva perumal
    Nov 21 at 16:14










  • @Sivaperumal take a look to the edition of the answer so you can understand what I am talking about.
    – Brank Victoria
    Nov 21 at 16:32










  • it didnt work but yes it gave me an idea of how to do this, thanks. I will try it
    – Siva perumal
    Nov 23 at 13:13

















up vote
1
down vote













If you want different font styles in your text view you can set it from HTML. Take a look to this post:



Is it possible to have multiple styles inside a TextView?



So in your case you can save the text entered in HTML format depending on what the user clicked to put <b> for bold, <i> for italics and so.



This will also help you to print it in the result textView, because you will print it from the HTML.



EDIT: For solve the problem that all your text is getting bold or italic, you must edit your onclick events to know the type of what you are writing. And also use TextWatcher to know what is the inserted text. For example:



int typeFaceSelected = Typeface.NORMAL //private global var with NORMAL as default value
String resultedText = ""; //private global var, this will give to your textview the result of the edittext in HTML
bold.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.BOLD
}
});
italics.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.ITALIC
}
});
normal.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.NORMAL
}
});

//You can edit the text you add
editCheck.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {}

public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

public void onTextChanged(CharSequence s, int start, int before, int count) {
String sAux = s.toString().subString(start, start + count);

switch(typeFaceSelected)
{
case Typeface.NORMAL:
resultedText = sAux;
break;
case Typeface.ITALIC:
resultedText = "<i>" + sAux + "</i>";
break;
case Typeface.BOLD:
resultedText = "<b>" + sAux + "</b>";
break;
}
editCheck.setText(Html.fromHtml(resultedText));
}
});

button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
result.setText(HTML.fromHTML(resultedText));
}
});


The above code was based on this Differences between TextWatcher 's onTextChanged, beforeTextChanged and afterTextChanged



Also, I haven't test it so I'm not sure if its working or not, but at least I think it is enough to get the idea.






share|improve this answer























  • even when I use html and the bold button is clicked, even the previously typed words are changed to bold. actually what I want is only when the user selects bold it should be bold from that word and not the previous word.
    – Siva perumal
    Nov 21 at 15:26










  • I know what you're saying, but in this case. You must change your code. This means that you have to change the logic inside your onclick events. Let me edit my answer so it would be clearer for you
    – Brank Victoria
    Nov 21 at 15:55










  • ok even I thought that would be the mistake but the logic is what I am not getting.
    – Siva perumal
    Nov 21 at 16:14










  • @Sivaperumal take a look to the edition of the answer so you can understand what I am talking about.
    – Brank Victoria
    Nov 21 at 16:32










  • it didnt work but yes it gave me an idea of how to do this, thanks. I will try it
    – Siva perumal
    Nov 23 at 13:13















up vote
1
down vote










up vote
1
down vote









If you want different font styles in your text view you can set it from HTML. Take a look to this post:



Is it possible to have multiple styles inside a TextView?



So in your case you can save the text entered in HTML format depending on what the user clicked to put <b> for bold, <i> for italics and so.



This will also help you to print it in the result textView, because you will print it from the HTML.



EDIT: For solve the problem that all your text is getting bold or italic, you must edit your onclick events to know the type of what you are writing. And also use TextWatcher to know what is the inserted text. For example:



int typeFaceSelected = Typeface.NORMAL //private global var with NORMAL as default value
String resultedText = ""; //private global var, this will give to your textview the result of the edittext in HTML
bold.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.BOLD
}
});
italics.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.ITALIC
}
});
normal.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.NORMAL
}
});

//You can edit the text you add
editCheck.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {}

public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

public void onTextChanged(CharSequence s, int start, int before, int count) {
String sAux = s.toString().subString(start, start + count);

switch(typeFaceSelected)
{
case Typeface.NORMAL:
resultedText = sAux;
break;
case Typeface.ITALIC:
resultedText = "<i>" + sAux + "</i>";
break;
case Typeface.BOLD:
resultedText = "<b>" + sAux + "</b>";
break;
}
editCheck.setText(Html.fromHtml(resultedText));
}
});

button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
result.setText(HTML.fromHTML(resultedText));
}
});


The above code was based on this Differences between TextWatcher 's onTextChanged, beforeTextChanged and afterTextChanged



Also, I haven't test it so I'm not sure if its working or not, but at least I think it is enough to get the idea.






share|improve this answer














If you want different font styles in your text view you can set it from HTML. Take a look to this post:



Is it possible to have multiple styles inside a TextView?



So in your case you can save the text entered in HTML format depending on what the user clicked to put <b> for bold, <i> for italics and so.



This will also help you to print it in the result textView, because you will print it from the HTML.



EDIT: For solve the problem that all your text is getting bold or italic, you must edit your onclick events to know the type of what you are writing. And also use TextWatcher to know what is the inserted text. For example:



int typeFaceSelected = Typeface.NORMAL //private global var with NORMAL as default value
String resultedText = ""; //private global var, this will give to your textview the result of the edittext in HTML
bold.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.BOLD
}
});
italics.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.ITALIC
}
});
normal.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
typeFaceSelected = Typeface.NORMAL
}
});

//You can edit the text you add
editCheck.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {}

public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

public void onTextChanged(CharSequence s, int start, int before, int count) {
String sAux = s.toString().subString(start, start + count);

switch(typeFaceSelected)
{
case Typeface.NORMAL:
resultedText = sAux;
break;
case Typeface.ITALIC:
resultedText = "<i>" + sAux + "</i>";
break;
case Typeface.BOLD:
resultedText = "<b>" + sAux + "</b>";
break;
}
editCheck.setText(Html.fromHtml(resultedText));
}
});

button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
result.setText(HTML.fromHTML(resultedText));
}
});


The above code was based on this Differences between TextWatcher 's onTextChanged, beforeTextChanged and afterTextChanged



Also, I haven't test it so I'm not sure if its working or not, but at least I think it is enough to get the idea.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 at 16:28

























answered Nov 21 at 14:37









Brank Victoria

1,038615




1,038615












  • even when I use html and the bold button is clicked, even the previously typed words are changed to bold. actually what I want is only when the user selects bold it should be bold from that word and not the previous word.
    – Siva perumal
    Nov 21 at 15:26










  • I know what you're saying, but in this case. You must change your code. This means that you have to change the logic inside your onclick events. Let me edit my answer so it would be clearer for you
    – Brank Victoria
    Nov 21 at 15:55










  • ok even I thought that would be the mistake but the logic is what I am not getting.
    – Siva perumal
    Nov 21 at 16:14










  • @Sivaperumal take a look to the edition of the answer so you can understand what I am talking about.
    – Brank Victoria
    Nov 21 at 16:32










  • it didnt work but yes it gave me an idea of how to do this, thanks. I will try it
    – Siva perumal
    Nov 23 at 13:13




















  • even when I use html and the bold button is clicked, even the previously typed words are changed to bold. actually what I want is only when the user selects bold it should be bold from that word and not the previous word.
    – Siva perumal
    Nov 21 at 15:26










  • I know what you're saying, but in this case. You must change your code. This means that you have to change the logic inside your onclick events. Let me edit my answer so it would be clearer for you
    – Brank Victoria
    Nov 21 at 15:55










  • ok even I thought that would be the mistake but the logic is what I am not getting.
    – Siva perumal
    Nov 21 at 16:14










  • @Sivaperumal take a look to the edition of the answer so you can understand what I am talking about.
    – Brank Victoria
    Nov 21 at 16:32










  • it didnt work but yes it gave me an idea of how to do this, thanks. I will try it
    – Siva perumal
    Nov 23 at 13:13


















even when I use html and the bold button is clicked, even the previously typed words are changed to bold. actually what I want is only when the user selects bold it should be bold from that word and not the previous word.
– Siva perumal
Nov 21 at 15:26




even when I use html and the bold button is clicked, even the previously typed words are changed to bold. actually what I want is only when the user selects bold it should be bold from that word and not the previous word.
– Siva perumal
Nov 21 at 15:26












I know what you're saying, but in this case. You must change your code. This means that you have to change the logic inside your onclick events. Let me edit my answer so it would be clearer for you
– Brank Victoria
Nov 21 at 15:55




I know what you're saying, but in this case. You must change your code. This means that you have to change the logic inside your onclick events. Let me edit my answer so it would be clearer for you
– Brank Victoria
Nov 21 at 15:55












ok even I thought that would be the mistake but the logic is what I am not getting.
– Siva perumal
Nov 21 at 16:14




ok even I thought that would be the mistake but the logic is what I am not getting.
– Siva perumal
Nov 21 at 16:14












@Sivaperumal take a look to the edition of the answer so you can understand what I am talking about.
– Brank Victoria
Nov 21 at 16:32




@Sivaperumal take a look to the edition of the answer so you can understand what I am talking about.
– Brank Victoria
Nov 21 at 16:32












it didnt work but yes it gave me an idea of how to do this, thanks. I will try it
– Siva perumal
Nov 23 at 13:13






it didnt work but yes it gave me an idea of how to do this, thanks. I will try it
– Siva perumal
Nov 23 at 13:13




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53414053%2fbold-and-italics-in-edittext%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Berounka

Different font size/position of beamer's navigation symbols template's content depending on regular/plain...

Sphinx de Gizeh