1

i'm reading the textfile(html tag file) in android and i trying to convert it into html. i'm getting error when i setText in textView(output).. The method setText(String, TextView.BufferType) is undefined for the type StringBuffer how to change StringBuilder to String to get ouput...

String s = "";
            StringBuilder str=null;
            while ((s = buffer.readLine()) != null){
                str.append(s+"/n");}
            String a=str.toString().trim();
            Spanned marked_up = Html.fromHtml(a);

            output.setText((marked_up).toString(),BufferType.SPANNABLE);

plz help ...

4

1 回答 1

1

Try like this. (To display HTML in the TextView Component)

myTextView.setText(Html.fromHtml(a));
于 2013-08-31T05:58:15.437 回答