I’m new to android and I’m trying to replace a character from bold style at a specific character in a arraylist string. What I’m doing is:
String myName = "76492";
This is my search string and i want to search this string in to the arraylist then i want to bold those character when getting on the arraylist.Arraylist string is 78758,3660,56798,6514,90679.
TextView txtf = (TextView)findViewById(R.id.textView4);
TextView txtS = (TextView) findViewById(R.id.textView5);
TextView txtT = (TextView)findViewById(R.id.textView6);
TextView txt1 = (TextView) findViewById(R.id.textView9);
TextView txt2 = (TextView) findViewById(R.id.textView13);
String str= myName.replaceAll("6", "<b>6</b>");
Spanned text = Html.fromHtml(str);
txtf.setText(text);
txtS.setText(text);
txtT.setText(text);
txt1.setText(text);
txt2.setText(text);
But this is replace all Textview String by the 76492 string with match charater bold style. 1879 search string this is replace old string but i donot want this type replace .iI want only specific position character change in bold style
Paste this code snippet in your style.xml which is in valuse folder under layout.
This line of code is for your text view appear as a bold.