I have a string-array in strings.xml. How can I underline the string in item?
I’ve added like this in the string
<string-array name="myarray">
<item> <Data> <![CDATA[ <u>Apple</u> ]]></Data> </item>`
<item> <Data> <![CDATA[ <u>Banana</u> ]]></Data> </item>
<item> <Data> <![CDATA[ <u>Orange</u> ]]></Data> </item>
and in the java file like this
final Button btn1;
btn1 = (Button) findViewById(R.id.button1);
btn1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final String q = myString[rgenerator.nextInt(myString.length)];
((Button) v).setText(q);
ArrayList<String> title_list = new ArrayList<String>();
String[] myarray_Array = getResources().getStringArray(R.array.myarray);
String categoryAndDesc = null;
for(String cad : myarray_Array) {
categoryAndDesc = cad;
title_list.add(categoryAndDesc);
}
CharSequence sequence = Html.fromHtml(categoryAndDesc);
btn1.setText(squence);
btn1.setMovementMethod(LinkMovementMethod.getInstance());
});
I will make a button that when clicked it will show random text taken from a string, What is wrong with the code above, please its support
use this:
or you can use: