Fu Qiang
Fu Qiang

Reputation: 13

AlertDialog.Builder setMessage in the text to wrap

AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(getString(R.string.update_dialog_tittle));
    builder.setMessage(updateInfo.getDescription());
    builder.setCancelable(false);

updateinfo is javabean,Is obtained by reading the site XML,The website XML

<?xml version="1.0" encoding="UTF-8"?><updateInfo><version>1.2</version><url>http://localhost:8080/test.apk</url><description>update\n1:test\n2:test\n3test\n4:test</description></updateInfo>

The text to display shows the "update \n1: test \n2: test \n3 test \n4: test", \n display, no wrapping effect

Upvotes: 1

Views: 411

Answers (1)

Bharatesh
Bharatesh

Reputation: 9009

Give a try if your XML replaces \n with <br>

<?xml version="1.0" encoding="UTF-8"><updateInfo><version>1.2</version><url>http://localhost:8080/test.apk</url><description>update<br>1:test<br>2:test<br>3:test<br>4:test</description></updateInfo></p> <br>    

You can try like this

builder.setMessage(Html.fromHtml(updateInfo.getDescription());

Upvotes: 1

Related Questions