Alternative for String.join in Android?

Solution 1:

You can use TextUtils.join instead:

String result = TextUtils.join(", ", list);

(String.join was added in Java 8, which is why you can't use it in Android.)

Solution 2:

String[] List ={"<html>","<body>","<title>"};
String abc;       
abc =TextUtils.join("\n", List);
textmsg.getText().insert(textmsg.getSelectionStart(), abc);

result:

<html>
<body>
<title>