Try to search your question here, if you can't find : Ask Any Question Now ?

Why the text is displayed on one line?

HomeCategory: stackoverflowWhy the text is displayed on one line?
Avatarrupesh asked 4 months ago

Well, I have a problem with my code, I need to download the code from the URL (code: php), using JSOUP on the Android platform. The site looks nice (data is separated by ENTER), and in the application everything is written in one String and I can not adjust it to your needs. Namely, I would like the data from the page to be identically arranged in the application.

private void getWebsite(){
         new Thread(new Runnable() {
        @Override
        public void run() {
            final StringBuilder builder = new StringBuilder();

            try {

                Document doc = Jsoup.connect("https://k69.pl/odtwarzacz/aplikacjaRadia.php").get();

                Elements links = ((Document) doc).select("body");


                    for(Element link : links){

                    builder.append(link.attr("<br>")).append(link.text());


                }

            } catch (IOException e){
                builder.append("Aplikacja nie mogła wykonać żądania. Zgłoś ten błąd do administratora aplikacji. Twój błąd to : ").append(e.getMessage()).append("n");
            }


            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    wynik.setText(builder.toString());
                }
            });

        }
    }).start();




}

Result from the site:

https://imgur.com/a/LrE3oOH

Result from the app:

https://imgur.com/a/IlotHa6

1 Answers
Best Answer
AvatarMatthias answered 4 months ago
Your Answer

0 + 10 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com