English 中文(简体)
• 如何处理安的标签
原标题:How to handle <br /> tags in Android

现在我一直在找寻,而仅仅打上了脚石,就能够找到正确的答案。 短篇大事,我翻一遍,把一页从 on上,用在我的盒子上。 我迫切需要在每一“主题”之间穿透线,因此,我把
标签放在我的营地。 它完全在一个网络浏览器上运作,但在我的安康申请中,我实际上可以看到
标签为明晰文本。 只是试图将其改为“延伸/新线”。 任何想法?

我的方法守则:

public String getInbox(String where){

        BufferedReader in = null;
        String data = null;
        try{


            HttpClient client = new DefaultHttpClient();
            URI website = new URI("http://example.com/getInbox.php?where="+where);

            HttpPost post_request = new HttpPost();
            post_request.setURI(website);


            HttpGet request = new HttpGet();

            request.setURI(website);
            //executing actual request

                        //add your implementation here
            HttpResponse response = client.execute(request);

            in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
            StringBuffer sb = new StringBuffer("");
            String l = "";
            String nl = System.getProperty("line.separator");
            while ((l = in.readLine()) != null) {
                sb.append(l+nl);

            }
            in.close();
            data = sb.toString();


return data;
        }catch (Exception e){
            return "ERROR";

        }

        }

网页上的产出:

eg test
eg test
eg lol
eg lol
eg testing

甲状腺素的产量:

eg test<br />eg test<br />eg lol<br />eg lol<br />eg testing<br />eg
最佳回答
String lineSep = System.getProperty("line.separator");
String yourString= "test<br />eg test<br />eg lol<br />eg lol<br />eg testing<br />eg34 ernestggggg";


yourString= yourString.replaceAll("<br />", lineSep):
问题回答

在您的网页浏览器上显示你的案文。 您需要使用以下方法:

TextView tv = (TextView)findViewById(R.id.tv);
tv.setText(Html.fromHtml(  " Overs Alloted "  + "<small> <small> " + "at start of innings" + "</small> </small>" ));  //Example

String s= getStringFromSoruce(parameters);  //Pass the string you need here
tv.setText(Html.fromHtml(s));

你可以采用任何观点制定案文。 你们甚至可以消除更多使用这种标签的html。

我希望这能解决你的目的:

check out this . replace <br /> tag with new line " "

data = sb.toString();

data = data.replaceAll("<br />", "
");

return data;

您可使用Html. fromHtml(,将html改为。 英文/法文 包括Html。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签