我已经在网上搜索了一段时间,只是无法确定这个问题的正确答案。长话短说,我正在从网上检索一个网页以用作我的收件箱。我迫切需要在每个“消息”之间跳过行,所以我
在我的 php.ini 中添加了标签。它在网络浏览器中完美运行,但在我的 Android 应用程序中,我实际上可以将
标签视为纯文本。只是试图将它们读作“下一行/新行”。有任何想法吗?
我的方法代码:
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
android中的输出:
eg test<br />eg test<br />eg lol<br />eg lol<br />eg testing<br />eg